Failed to modify java.io.tmpdir

I am trying to change the java.io.tmpdir directory using this command

java -Djava.io.tmpdir=/temporary 

But this fails and displays the "Usage" of the java command. I do this on an RHEL machine.

Thanks in advance

I deployed a WebLogiv application that uses axis2 version 1.5. I find that axis2 1.5 using java.io.tmpdir to store temporary files. I want where these temporary files are stored. Where in weblogic indicate the value java.io.tmpdir

+6
source share
2 answers

You need to use this command as part of running the program, not just java -Dkey=value .

 java -Djava.io.tmpdir=/temporary com.foo.Bar 

where com.foo.Bar is the class containing the main method.

Alternatively, you can do this programmatically.

 System.setProperty("java.io.tmpdir", "/temporary"); 
+17
source

Take a look at this answer fooobar.com/questions/70313 / ...

In particular, this part:

When starting the Java virtual machine, a different value may be assigned, but programmatic changes to this property do not guarantee any effect on the temporary directory used by this method.

+4
source

Source: https://habr.com/ru/post/912943/


All Articles