Before changing the default, find the current default in the system by typing
java -version
This should give something like
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
Now check the other versions installed on the system
/usr/libexec/java_home -V
This should give something like
Matching Java Virtual Machines (2):
1.8.0_45, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
1.7.0_79, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Now change the version to Java 8
export JAVA_HOME='/usr/libexec/java_home -v 1.8.0_45'
Verify if this is changed by giving the same command again
java -version
This should now show the changed default
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
No comments:
Post a Comment