环境变量来控制java.io.tmpdir? [英] Environment variable to control java.io.tmpdir?
问题描述
我使用 TMP
环境变量来控制像gcc写它是临时文件,但我似乎找不到等效的java的 createTempFile API。
这样的环境变量是否存在?
在 Windows ,OpenJDK的 get_temp_directory c $ c>函数使Win32 API调用
GetTempPath()
;这是在Windows上,Java反映 TMP
环境变量的值。
在 Linux 和< a href =http://hg.openjdk.java.net/jdk6/jdk6/hotspot/file/14f7b2425c86/src/os/solaris/vm/os_solaris.cpp#l1828 =nofollow noreferrer> Solaris < a>,相同的 get_temp_directory()
函数返回 / tmp /
的静态值。
我不知道实际的JDK6是否遵循这些确切的约定,而是通过在每个列出的平台上的行为,看起来像他们做的。
I've used the TMP
environment variable to control things like where gcc writes it's temporary files, but I can't seem to find an equivalent for java's createTempFile API.
Does such an environment variable exist?
Hmmm -- since this is handled by the JVM, I delved into the OpenJDK VM source code a little bit, thinking that maybe what's done by OpenJDK mimics what's done by Java 6 and prior. It isn't reassuring that there's a way to do this other than on Windows.
On Windows, OpenJDK's get_temp_directory()
function makes a Win32 API call to GetTempPath()
; this is how on Windows, Java reflects the value of the TMP
environment variable.
On Linux and Solaris, the same get_temp_directory()
functions return a static value of /tmp/
.
I don't know if the actual JDK6 follows these exact conventions, but by the behavior on each of the listed platforms, it seems like they do.
这篇关于环境变量来控制java.io.tmpdir?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!