(I wasn’t sure if it was worth doing with SU ... migration is definitely an option, but more programmers read questions here, so here).
I am using Mac OS X 10.8.4 and I have installed Apple JDK 1.6.0_51 and Oracle JDK 1.7.0_25. I recently installed the Oracle 1.8 Preview JDK for some preview version of the software that requires this. Now when I run / usr / libexec / java_home, I get this:
$ /usr/libexec/java_home -V Matching Java Virtual Machines (4): 1.8.0, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home 1.7.0_25, x86_64: "Java SE 7" /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home 1.6.0_51-b11-457, x86_64: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 1.6.0_51-b11-457, i386: "Java SE 6" /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Fine.
However, it works:
$ java -version
Returns:
java version "1.8.0-ea"
This means that the default Java version is currently a preview version that breaks some “normal” packages (in my case, VisualVM).
I cannot set JAVA_HOME because when I launch applications, environment variables are ignored, even when launched from the command line (for example, $ open/Applications/VisualVM.app ).
So, is there a file that I can edit where I can set my JVM ordering preferences globally?
(Please do not tell me to launch the Java settings panel because it simply does not work: it does not contain anything useful and contains only one of the 4 JVMs that I installed.)
Update :
Oracle JVMs live in /Library/Java/JavaVirtualMachines . jdk1.8.0.jvm.xyz the JDK 1.8 directory in jdk1.8.0.jvm.xyz does not change anything: java_home still finds it in the right place, and running / usr / bin / java still runs the 1.8 JVM. This is not a problem with links, etc.
Answers to similar questions
Although this answer suggests what constitutes a hack that will remove Java versions from choosing java_home, it still does not answer the question of how java_home chooses the default value and whether users can set it non-destructively .
java java-home macos
Christopher Schultz Jul 26 '13 at 15:36 2013-07-26 15:36
source share