Running Java applications on OS X with only Java 7 installed

If Java 7 is the only Java environment on a Mac, quite a few applications demand the installation of a Java 6 environment:

To open “Eclipse”, you need a Java SE 6 runtime. Would you like to install one now?

To open “Adobe Device Central CS5”, you need a Java 6 SE runtime. Would you like to install one now?

To open “Cyberduck”, you need a Java 6 SE runtime. Would you like to install one now?

want-java-6

I didn’t want to pollute my Mac with an outdated Java version. Here’s a tip that works well with Eclipse and CS5 and may work with other Java software which ignores the presence of a Java 7 SDK as well. So far I’ve only tested it with OS X 10.8.3. It may or may not work with earlier or later versions of OS X.

At first you need to determine which Java 7 version is currently installed. Open Terminal and enter

cd /Library/Java/JavaVirtualMachines
ls

You should get something like

jdk1.7.0_21.jdk

I’m using this version as a sample below.┬áReplace the name of the Java 7 SDK directory in the first line below and execute the commands:

export JDK=jdk1.7.0_21.jdk # needs to be replaced!
sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/$JDK \
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk

And you’re all set!

One reply on “Running Java applications on OS X with only Java 7 installed”

  1. The same problem also applies to Adobe Photoshop CS 4 & Adobe Photoshop CS5 on OS X 10.7.5.
    Unfortunately the guidance above does not quite fit the OS X 10.7.5 environment. In particular there is nothing visible in the JavaVirtualMachines directory. Java SE 7 is installed since it is visible in preferences. Any ideas or links on a work around for 10.7.5?

Comments are closed.