Locate user temp directory

Discussion in 'Java' started by brittonsm@gmail.com, Dec 21, 2007.

  1. Guest

    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
    , Dec 21, 2007
    #1
    1. Advertising

  2. Lew Guest

    wrote:
    > 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/api/java/lang/System.html#getProperty(java.lang.String,%20java.lang.String)>


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

    --
    Lew
    Lew, Dec 21, 2007
    #2
    1. Advertising

  3. Roedy Green Guest

    On Fri, 21 Dec 2007 08:09:33 -0800 (PST), wrote,
    quoted or indirectly quoted someone who said :

    >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?


    see http://mindprod.com/jgloss/set.html
    http://mindprod.com/jgloss/environment.html
    http://mindprod.com/jgloss/properties.html#SECURITY
    http://mindprod.com/jgloss/applet/wassup.html

    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
    Roedy Green, Dec 24, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    556
    Mark P
    May 9, 2005
  2. Lakshmi

    WinAPI to locate a file in directory

    Lakshmi, Sep 22, 2004, in forum: C Programming
    Replies:
    2
    Views:
    302
    Lakshmi
    Sep 22, 2004
  3. Najd

    Get user Temp directory

    Najd, Apr 13, 2006, in forum: C++
    Replies:
    6
    Views:
    1,137
  4. A. Farber
    Replies:
    3
    Views:
    237
    Ben Morrow
    Mar 3, 2004
  5. PerlFAQ Server
    Replies:
    0
    Views:
    242
    PerlFAQ Server
    Apr 26, 2011
Loading...

Share This Page