Results 1 to 13 of 13
  1. #1
    prabhug1987 is offline Member
    Join Date
    Jul 2010
    Posts
    14
    Rep Power
    0

    Question how to get the default installation path

    Hi

    I am trying to find the window default installation path for installing the software. help me

    thanks in advance

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    There is no direct way to find the system folder using Java. However with a proper combination of several system properties it could be done.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    For an example, following statement always return the system drive in windows.

    Java Code:
    System.getProperty("user.home").charAt(0)
    And there are many other ways to do that.

  4. #4
    prabhug1987 is offline Member
    Join Date
    Jul 2010
    Posts
    14
    Rep Power
    0

    Default

    thanks Eranga,

    it shows user directory as c. But i want to find the find path where the software is going to installed. for example java will be installed in c:\program files\java.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Do you want to find the specifically any application installed path or the common installation path?

    The thing is this, in most of the installation you can define the custom folder paths, like in D: and so on. For example JDK could install in C: drive.

  6. #6
    prabhug1987 is offline Member
    Join Date
    Jul 2010
    Posts
    14
    Rep Power
    0

    Default

    i want common installation path..

  7. #7
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,087
    Rep Power
    20

    Default

    Quote Originally Posted by Eranga View Post
    Do you want to find the specifically any application installed path or the common installation path?

    The thing is this, in most of the installation you can define the custom folder paths, like in D: and so on. For example JDK could install in C: drive.
    I've got half a dozen JDKs installed on my D: drive on this machine, in a jdks folder.

    I'm not sure there is a "common installation path", is there? At least not in the system properties.

  8. #8
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    In System Properties you cannot find a such. But as I said you can manipulate it in many ways,

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Quote Originally Posted by prabhug1987 View Post
    i want common installation path..
    It's SystemDirve:\Program Files

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,087
    Rep Power
    20

    Default

    Except on my machine which has two.
    ProgramFiles and Program Files (x86).

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Yes, it's correct. In my PC I've three systems partitions. But the point is, there is only one system drives, unless you don't have Windows installations.

    But there is only one user root, in a single OS installation. So that user.home always have one value.

    Say I've XP in drive c, it'll returns C:\Document & Settings\Eranga if I'm log into XP. Say Win7 in drive D: then the return is D:\Document & Settings\Eranga

  12. #12
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,087
    Rep Power
    20

    Default

    Oh yes, user.home is easy.
    At least on Windows and *nix-based, not had to use anything else in years.

    But "common installation path" is a nonsense, even on Windows.

  13. #13
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. setting class-path & Library Path in ubantu
    By programmer_007 in forum Eclipse
    Replies: 18
    Last Post: 02-22-2010, 12:31 PM
  2. Replies: 13
    Last Post: 01-24-2010, 10:58 AM
  3. Replies: 0
    Last Post: 01-18-2010, 02:57 AM
  4. Read eclipse installation path in java
    By java_kick in forum Advanced Java
    Replies: 0
    Last Post: 03-23-2009, 02:49 PM
  5. Replies: 1
    Last Post: 03-10-2009, 01:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •