Skip to main content

Posts

Showing posts from September, 2016

JAVA_HOME vs java.home

What's the difference between JAVA_HOME and java.home? JAVA_HOME is the  JDK  install directory, e.g., C:\jdk5. It's meant to be set as an environment variable and referenced in Windows batch files or Unix scripts. I always have it in my Windows Control Panel and .tcsh files,along with other common environment variables. Some Java applications use the name jdk.home for this purpose, which I think is a better name. But JAVA_HOME has been used since the beginning and is now a convention. java.home is the  JRE  install directory, e.g.,  C:\jdk5\jre, or C:\Program Files\Java\jre1.5.0_06 . Unlike JAVA_HOME, I never seen java.home as an environment variable. java.home is a build-in Java system property, whose value is the  JRE  install directory. Since all Java system properties are also exposed as Ant build properties, you can also use ${java.home} in build files. Would jre.home be a better name? Maybe, but I don't think Sun will change it. Therefore, java.home is always there