how to get the current path

Discussion in 'Java' started by Happy Day, Nov 19, 2006.

  1. Happy Day

    Happy Day Guest

    Hi
    I want to get the current working path. I used method
    "System.getProperty("user.dir").", but it showed only part of full
    path.
    How can I find full path?
    Happy Day, Nov 19, 2006
    #1
    1. Advertising

  2. Happy Day

    Guest

    Happy Day wrote:
    > Hi
    > I want to get the current working path. I used method
    > "System.getProperty("user.dir").", but it showed only part of full
    > path.
    > How can I find full path?


    it works fine on my wndows

    ie. a.java

    public class a{
    public static String path(){
    String p=System.getproperty("user.dir");
    }
    //call in main
    println(pathdir());
    }

    outpur : C:\Documents and Settings\username\desktop
    , Nov 19, 2006
    #2
    1. Advertising

  3. Happy Day wrote:
    > Hi
    > I want to get the current working path. I used method
    > "System.getProperty("user.dir").", but it showed only part of full
    > path.
    > How can I find full path?


    Or you may want to use a File such as:

    new File(System.getProperty("user.dir")).getAbsolutePath()

    Regards / Lars Borup Jensen
    http://www.it-arbejde.dk
    Lars Borup Jensen, Nov 20, 2006
    #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. Chung

    How to get current folder path?

    Chung, Nov 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    10,250
    Nazer
    Jan 20, 2008
  2. PHaroZ
    Replies:
    5
    Views:
    94,667
    akash02sap
    Aug 17, 2012
  3. Eranga Udesh

    Howto get the current file path with SSI

    Eranga Udesh, Apr 5, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,079
    Aaron Bertrand [MVP]
    Apr 6, 2004
  4. Olav Tollefsen

    How to get directory path of current rquest?

    Olav Tollefsen, Oct 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,194
    Scott Mitchell [MVP]
    Oct 29, 2004
  5. farmer
    Replies:
    10
    Views:
    33,261
    farmer
    Oct 25, 2005
Loading...

Share This Page