0
votes

I am new about java. after using the Java Preference of Mac to update the JAVA to 7, I got mixed these default JAVA path in Mac.

  1. When I type "java -version", it shows: java 1.7.0_17. And when I type "mvn -version", it shows the JAVA HOME: "/Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre"

  2. But I type "/System/Library/Frameworks/JavaVM.framework/Versions/", it shows several directory including " Current, CurrentJDK" ,and type CurrentJDK/Home/bin/java -version. it shows java1.6

  3. When I see ~/.bash_profile, it shows export JAVA_HOME="/usr/libexec/java_home"

Can anyone tell me the difference of these path. I am mixed.

1
The Mac OS uses symbolic links that point to the "current" JDK. This means that you can have multiple JDK/JRE's installed, but, by default, only one will be used by defaultMadProgrammer
but the CurrentJDK show java 1.6, but java -version shows java 1.7 @MadProgrammerJoJo

1 Answers

0
votes

Until some time ago, Apple shipped its own versions of Java. These were installed as official system components in

[1] /System/Library/Frameworks/JavaVM.framework/Versions/

With Java 6, Apple stopped supporting Java. Since Java 7, Oracle supplies Java versions for OS X. These are in

[2] /Library/Java/JavaVirtualMachines

Hence, the settings in [1] lost effect by now and /usr/libexec/java_home returns a location under [2]. I believe we can expect [1] to completely disappear with new versions of OS X.