Mac – print java home on command line

To print Java (JVM) home path on command line the following command (jave_home) can be used as shown below:

$ /usr/libexec/java_home 
/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home

To display all path of all JVMs:

$ /usr/libexec/java_home -V
/usr/libexec/java_home -V
Matching Java Virtual Machines (3):
    1.7.0_65, x86_64:	"Java SE 7"	/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home
    1.6.0_65-b14-468, x86_64:	"Java SE 6"	/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
    1.6.0_65-b14-468, i386:	"Java SE 6"	/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home
Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit

Comments

Click here to write/view comments