Search code examples
javamacosjavac

Upgrading java version to use latest from JDK 8


I just downloaded the latest JDK 8 from Oracle and ran the installer on Mac OS X.

However, even after restarting, I see I'm still on version 1.6

$ java -version
java version "1.6.0_65"

What do I do to get it to use version 1.8?


Solution

  • With the Java optional package or Oracle JDK installed, adding the following line ~/.bash_profile file will set the environment variable accordingly.

    export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"