Environment variable to control java.io.tmpdir?
configuration, environment-variables, java, temp
Solution
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.
Problem
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?