#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    50
    Rep Power
    12

    Looking for the application path


    Hello. How do I search for the application pathname? like the AppPath in visual basic, is there a way in Java to find the application path?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    78
    Rep Power
    12
    I'm not too sure what you are asking for but in java there are 2 paths you need to be aware of.

    1. The PATH variable so that you can run java.exe (win32) or java (linux) without specifing the full path.

    i.e java MyClass instead of /usr/local/bin/java

    2. The CLASSPATH variable is the location of any and all class, zip, properties and jar files that are to be used in your classes or any code that your classes reference.

    Both of these are environment variables and can be inspected by viewing them in the command line...
    Code:
    echo %PATH%
    echo $PATH
    
    echo %CLASSPATH%
    echo $CLASSPATH
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    50
    Rep Power
    12
    Thanks for your reply, but is there's a method or function to find the application path or the current directory?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    78
    Rep Power
    12
    Give this a try...

    Code:
    String homeDir = System.getProperty("java.home");
    or

    Code:
    String classpath = System.getProperty("java.class.path");

    I got this info here...

    http://java.sun.com/j2se/1.4.2/docs/api/

    Hope this helps.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    50
    Rep Power
    12
    Thanks a lot for your help

IMN logo majestic logo threadwatch logo seochat tools logo