Locate user temp directory

B

brittonsm

I'm new to java, but in VBA I can do this strWordPathTemp =
Environ("TEMP") which gives me the users default temp directory - How
do you do this in java?

-Steve
 
L

Lew

I'm new to java [sic], but in VBA I can do this strWordPathTemp =
Environ("TEMP") which gives me the users default temp directory - How
do you do this in java [sic]?

It's "Java", not "java".

<http://java.sun.com/javase/6/docs/api/java/lang/System.html#getenv(java.lang.String)>

There is a link there to
<http://java.sun.com/javase/6/docs/api/java/lang/System.html#getenv()>
on the same page.

For things like the user's default temp directory, though, you probably want
system properties rather than environment variables, for reasons explained in
the above links.

<http://java.sun.com/javase/6/docs/api/java/lang/System.html#getProperties()>
<http://java.sun.com/javase/6/docs/api/java/lang/System.html#getProperty(java.lang.String)>

<http://java.sun.com/javase/6/docs/a...tProperty(java.lang.String, java.lang.String)>


Your question would be answered by a call to
System.getProperty( "java.io.tmpdir" );
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top