无法更改java.io.tmpdir

时间:2021-03-17 08:10:03

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

我正在尝试使用此命令更改java.io.tmpdir目录

java -Djava.io.tmpdir=/temporary

But this doesnot succeed and displays the 'Usage' of the java command. I am doing this in a RHEL machine.

但这并不成功,并显示java命令的“用法”。我在RHEL机器上这样做。

Thanks in advance

提前致谢

I have deployed an application on WebLogiv which uses axis2 version 1.5. I find that axis2 1.5 using java.io.tmpdir to store its temp files. I want the location where these temp files are stored. Where in the weblogic do I specify the java.io.tmpdir value

我在WebLogiv上部署了一个使用axis2版本1.5的应用程序。我发现axis2 1.5使用java.io.tmpdir来存储其临时文件。我想要存储这些临时文件的位置。我在weblogic中指定了java.io.tmpdir值

2 个解决方案

#1


17  

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

您需要将该命令用作运行程序的一部分,而不仅仅是java -Dkey = value。

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

where com.foo.Bar is the class which contains the main method.

其中com.foo.Bar是包含main方法的类。

Alternatively, you can do this programmatically.

或者,您可以以编程方式执行此操作。

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

#2


4  

Take a look at this answer https://*.com/a/1924159/594793

看看这个答案https://*.com/a/1924159/594793

Specifically, this part:

具体来说,这部分:

A different value may be given to this system property when the Java virtual machine is invoked, but programmatic changes to this property are not guaranteed to have any effect upon the the temporary directory used by this method.

调用Java虚拟机时,可以为此系统属性提供不同的值,但不保证对此属性的编程更改会对此方法使用的临时目录产生任何影响。

#1


17  

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

您需要将该命令用作运行程序的一部分,而不仅仅是java -Dkey = value。

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

where com.foo.Bar is the class which contains the main method.

其中com.foo.Bar是包含main方法的类。

Alternatively, you can do this programmatically.

或者,您可以以编程方式执行此操作。

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

#2


4  

Take a look at this answer https://*.com/a/1924159/594793

看看这个答案https://*.com/a/1924159/594793

Specifically, this part:

具体来说,这部分:

A different value may be given to this system property when the Java virtual machine is invoked, but programmatic changes to this property are not guaranteed to have any effect upon the the temporary directory used by this method.

调用Java虚拟机时,可以为此系统属性提供不同的值,但不保证对此属性的编程更改会对此方法使用的临时目录产生任何影响。