MacOS – How to launch apps that require Java on Mountain Lion with only Java 7 installed


Just got a brand new MacBook Air which shipped with Mountain Lion 10.8.4 and no Java installed. There is a /usr/bin/java, but running it would prompt me to install an Apple-distributed Java 6 runtime in a Cocoa dialog.

However, Oracle is no longer supporting Java 6, and I don't want to be running an unsupported and probably insecure Java installation.

So, I went to Oracle's Java SE downloads and installed the latest JDK, jdk-7u25-macosx-x64. Now the only Java I have on this machine is 1.7.0_25, distributed by Oracle. /usr/bin/java -version now works.

I just ran brew cask install eclipse, and ended up with Eclipse 4.3. When I first tried to run it, I got the same prompt to install a Java runtime as if I had no Java installed.

So I looked here on Apple StackExchange and found After running sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk, I'm now able to launch Eclipse.

However, when I try to launch other apps that require Java, such as /usr/share/java/Tools/Java and /opt/homebrew-cask/Caskroom/webstorm/6.0.2a/, I get an error that no compatible Java 1.6 is available (see below).

screenshot of error dialog

Does anyone know if it's possible to get these other apps working, or do they really actually require Java 6 and can't work with Java 7?

Best Answer

The dialog is shown because Oracle's Java has only partial 'JVMCapabilities' set and advertises itself as command-line-only capable.

As a superuser (use 'sudo' if editing in Terminal), you should edit /Library/Java/JavaVirtualMachines/jdk.1.7.[version-and-release].jdk/Contents/Info.plist and find the following key:


and add it to include the missing values:


After that, you have to either reboot, logout or killall Finder, what ever seems to work. (People have reported that restarting Finder was enough, but I had to log out.)