OSX JAVA JDK installation and setup

From Notepedia
Jump to: navigation, search

Using the OSX JAVA JDK installers will put the files in undisclosed locations on the HDD making fixing JAVA_HOME issues painful, so here's what you need to know:


Java Virtual Machine install directory

/Library/Java/JavaVirtualMachines

Links to Java Virtual Machines live in the following directory. This model isn't used on more modern versions or OSX 10.10 or newer

/System/Library/Frameworks/JavaVM.framework/Versions/

Browser plugins live in this directory

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin

Java Home command to query the Java Virtual Environments variable

/usr/libexec/java_home

List installed Versions of Java using the Java Home command

/usr/libexec/java_home -v "1.6"
/usr/libexec/java_home -v "1.7"
/usr/libexec/java_home -v "1.8"

Set JAVA_HOME environment variable (In this example, setting JAVA_HOME to JAVA 8)

vim .zshrc OR vim .bashrc
export JAVA_HOME=`/usr/libexec/java_home -v "1.8"`