Note that there are some explanatory texts on larger screens.

plurals
  1. POSpecify path to java properties path at runtime
    primarykey
    data
    text
    <p>I apologize in advance if this has been answered already, but I'm unable to find anything specifically relating to this. I have a python program that launches a subprocess, at runtime, which calls a java jar file. The command looks like this:</p> <pre><code># Build command line expression. expr = self.cmmTool + " " + self.cmmIpAddress + " " + self.cmmUsername + " " + self.cmmPassword + " " + cmd + " &gt; " + self.cmmOutputFile # Execute command line expression. p = subprocess.Popen(expr, shell=True) </code></pre> <p>If I launch my python program from a command line, all is well. An important note is that the jar file will create a SMCIPMITool.properties in the same path as the jar file. My problem is that I want to run my python program as a service. When I start the service, the python program executes fine, but has a problem with this call. My python program catches this and the program does not crash, so it will repeatedly try to execute this. The output from the java file goes into the file specified above and looks like this:</p> <pre><code>java.io.FileNotFoundException: ./SMCIPMITool.properties (Permission denied) java.io.FileNotFoundException: ./SMCIPMITool.properties (No such file or directory) java.io.FileNotFoundException: ./SMCIPMITool.properties (Permission denied) java.io.FileNotFoundException: ./SMCIPMITool.properties (No such file or directory) java.io.FileNotFoundException: ./SMCIPMITool.properties (No such file or directory) java.io.FileNotFoundException: ./SMCIPMITool.properties (No such file or directory) java.io.FileNotFoundException: ./SMCIPMITool.properties (Permission denied) java.io.FileNotFoundException: ./SMCIPMITool.properties (Permission denied) java.io.FileNotFoundException: ./SMCIPMITool.properties (No such file or directory) </code></pre> <p>Bear in mind, this is not my jar file (precompiled by super micro), so I have no control over the java code. It seems the java file, running in "service land", is either trying to write the .properties file in a location it doesn't have write access to, and/or can't find the .properties file. Also to note, the jar and .properties file both exist in the same directory. It seems when the jar file is executed in "service land" it's perhaps not actually being executed in the directory where the jar file is located. </p> <p>Is it possible to specify the path to the .properties file explicitly when I call java -jar? Is there a way to set the default path to .properies files in JRE somehow? I'm a bit at a loss for next steps and google isn't helping. Any help would be greatly appreciated!</p> <p>Edited with copy paste of actual code. The cmmTool variable contains /path/to/jar/jarFile</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload