Get path to java JRE

前端 未结 3 686
半阙折子戏
半阙折子戏 2020-12-06 04:40

It it possible to get the location of the jre that is used for the current process. Need to launch an other java application as a separate process. Having different jre\'s a

相关标签:
3条回答
  • 2020-12-06 04:50

    System.out.println(System.getProperty("java.home"));

    The code above will return the full physical path to current jvm's jre path. Tested only in Windows 10.

    0 讨论(0)
  • 2020-12-06 04:52
    System.getProperty("java.home")
    
    0 讨论(0)
  • 2020-12-06 05:03

    You can use:

    System.getProperty("java.home")
    

    http://download.oracle.com/javase/6/docs/api/java/lang/System.html#getProperties%28%29 says:

    java.home: Java installation directory

    0 讨论(0)
提交回复
热议问题