Where does Ant set its 'java.home' (and is it wrong) and is it supposed to append '/jre'?

后端 未结 2 1487
一个人的身影
一个人的身影 2020-12-17 16:46

Okay, I\'m using Ant version 1.7.1 (default install) on CentOS 6.3:

[theuser@dev-ingyhere ~]$ ant -version
Apache Ant version 1.7.1 compiled on August 24 20         


        
相关标签:
2条回答
  • 2020-12-17 17:25

    Really a JVM internals question

    Since Ant is just echoing the java.lang.System properties (see comment above under original post), this is really a JVM question. The Java HotSpot Virtual Machine is the core interpreter. Code is available online at hg.openjdk.java.net.

    On line 309 of the C++ code for HotSpot (os_linux.cpp) there is a an init_system_properties_values() method in the os class. It does some mild heuristics to kind of sniff out the location for a variable named home_path which ends up being set to what Java users see as "java.home". Comments in the code indicate that '<java_home>/jre' is being formally specified as the java.lang.System property value for "java.home" (in the case of a JDK install).

    0 讨论(0)
  • 2020-12-17 17:42

    I had a JDK installed on a Windows box in d:\jdk but running its d:\jdk\bin\java.exe with -XshowSettings showed its built-in java.home pointing to the system-wide JRE install in c:\Program Files\Java\jre1.8.0_91. I suspect that I corrupted my install by deleting d:\jdk\jre without understanding the role of a private JRE vs public JRE.

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