'OSX Mavericks "You need a Java 6 runtime to run X" error dialog fix'

9 years ago

Ok, so here's the deal: If you upgrade to [OSX Mavericks](https://www.apple.com/osx/preview/), only had JAVA 7 installed, and try to run anything that requires JAVA you will probably get a nice dialog like this one:

All my attempts to make Mavericks use JAVA 7 instead have failed so i tried the next best thing: Install JAVA 6. Since you can't find JAVA 6 for Mac at the [Oracle](http://java.oracle.com) site, you'll have to install it from here: [Java for OS X 2013-004](http://support.apple.com/kb/DL1572).

After installing you'll end up with this following structure at the "/System/Library/Frameworks/JavaVM.framework/Versions" folder:

drwxr-xr-x 11 root wheel 374 29 Ago 14: lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.4@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.4.2@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.5@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.5.0@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.6@ -> CurrentJDK lrwxr-xr-x 1 root wheel 10 29 Ago 14:58 1.6.0@ -> CurrentJDK drwxr-xr-x 7 root wheel 238 29 Ago 14:58 A/ lrwxr-xr-x 1 root wheel 1 29 Ago 14:58 Current@ -> A lrwxr-xr-x 1 root wheel 59 29 Ago 14:58 CurrentJDK@ -> /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents

So you might want to fix the path to the current JDK, so that you keep using the JDK 7 by default (Eclipse users, you know what i mean ;)):

$ sudo rm CurrentJDK $ sudo ln -s /Library/Java/ $ sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents CurrentJDK

Another thing you might need to change is the JAVA_HOME environment variable but, since that depends on whatever shell you use, [Google it](https://duckduckgo.com/?q=set+JAVA_HOME+in+bash) ;)

Finally, verify that you are still using JAVA 7 by default:

$ javac -version javac 1.7.0_25 $ java -version java version "1.7.0_25"

Have fun.