环境变量来控制java.io.tmpdir? [英] Environment variable to control java.io.tmpdir?
问题描述
我已经使用 TMP
环境变量来控制gcc写入它的临时文件的地方,但是似乎找不到java的 createTempFile API。
这样的环境变量是否存在?
在 Windows ,OpenJDK的 get_temp_directory()
函数使Win32 API调用到 GetTempPath()
;这是Windows上如何,Java反映了 TMP
环境变量的价值。
在 Linux 和 Solaris ,相同的 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屋!