How can I find the location of the JDK directory in Java?
Is there a similar property like System.getProperty ("java.home") that will return the JDK directory instead of the JRE directory? I took a look at http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties () and nothing seems to exist for the JDK.
+1
source to share
3 answers
There is no java.home
JDK- like property . There are some rules of thumb that can help you determine if the JRE you are working in is part of the JDK. For example, search for "$ {java.home} /../ lib / tools.jar". In other words, in some cases you can suggest the default, but in general the user has to tell you which JDK to use.
+2
source to share