I performed a clean installation of Mountain Lion and installed JDK7.

java -version in Terminal returns java version "1.7.0_05" correctly, still Java Preferences and some other Java programs (such as Eclipse) result in prompts to install Java SE 6.

I can start Eclipse perfectly from the command line with Java 7.

Is there a way to get this working without having to install Java 6?

  • 1
    This is really messed up. Why on earth is this still not fixed? Isn't increased security the main motivation for why Apple gave up control over the Java update procedure? Why then does OSX still prompt me to install an outdated Java? Yikes!
    – gentmatt
    Commented Jan 30, 2013 at 15:08
  • @gentmatt Java 7 is not a simple update for Java 6 - it is more like changing OSs. SOme things will break using the larger version and both major versions are updated for security fixes
    – mmmmmm
    Commented Mar 25, 2013 at 17:42
  • @gentmatt Apple didn't want Java anymore and essentially abandoned it. Oracle chose to pick up the ball. Commented Apr 15, 2013 at 10:41
  • 1
    It's still stupid to require Java 6, given that it's now deprecated… Commented Jul 27, 2013 at 13:54

3 Answers 3


JDK 7 will be installed under /Library/Java/JavaVirtualMachines/1.7.0.jdk, JDK 6 under /System/Library/Java/JavaVirtualMachines.

To trick OS X to accept Java 7 instead of proposing to install Java 6 a simple symlink is enough:

sudo mkdir /System/Library/Java/JavaVirtualMachines
sudo ln -s /Library/Java/JavaVirtualMachines/1.7.0.jdk /System/Library/Java/JavaVirtualMachines/1.6.0.jdk

Most Java Programms will run with this little hack without the need to install Java 6. OS X's Java Preferences (and maybe some others) will not as it seems to explicitly check the version of the JVM when it is started.

  • 1
    The second line should not have "su", it should be "sudo ln -s ....." Commented Aug 17, 2012 at 8:15
  • 3
    I just did a fresh install including JDK 7u9, and it was installed to /Library/Java/JavaVirtualMachines/jdk1.7.0_09.jdk; the instructions worked fine otherwise. Commented Nov 22, 2012 at 1:05
  • 3
    Watch out for doing the symlink... Apple released 1.6 security update recently. If you apply this update from Apple, the symlink seems to fool the update and installs 1.6 update into where the symlink points to, i.e. Oracle's 1.7.
    – user39972
    Commented Jan 19, 2013 at 18:04
  • This could break things if a Java program requires Java 6 and not 7 it could break when you use the other version.
    – mmmmmm
    Commented Mar 25, 2013 at 17:43
  • Here is a better solution if you are on Mavericks: stackoverflow.com/questions/19563766/…
    – jedesah
    Commented Jan 28, 2014 at 3:10

Note: if you have something that really needs java6 and won't work with java7, then you might want to hold-off on installing java7. The reason is it might be a little tricky to try to keep both 6 and 7 on same macintosh, as the 7 pkg does some messing with some of the apple-6-java items, as detailed below. So, I'll be looking for some step-by-step instructions on keeping 6 and 7 on same mac before rolling this out... See also http://reviews.cnet.com/8301-13727_7-57533880-263/java-preferences-missing-after-latest-os-x-java-update/ on Oct 18, 2012.

DETAILS The preinstall shell script in jre-7u9-macosx-x64.dmg just removes the Apple pref-pane (as well as plug-in), without warning, below.

PLUGIN_BASEDIR=/Library/Internet\ Plug-Ins
MKDIR=`which mkdir`
# Remove the symlink before installation forcing ystem Preferences.app to refresh its cache
# Actually removes the symlink
if [[ -h "${PREF_PANE_DEST}/${PREF_PANE_NAME}" ]]; then
     ${RM} -rf "${PREF_PANE_DEST}/${PREF_PANE_NAME}"
# Create the /Library/Internet Plug-Ins if not present
if [[ ! -d "${PLUGIN_BASEDIR}" ]]; then
     ${MKDIR} -p "${PLUGIN_BASEDIR}"
# If Apple's plugin is present, then delete it
if [[ -h "${PLUGIN_NAME}" ]] && [[ -d "${PLUGIN_NAME}" ]]; then
    ${RM} -rf "${PLUGIN_NAME}"

=== And the post install script sets up a symlink ===

LN=`which ln`
CHOWN=`which chown`
PLUGIN_FILEPATH=/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
PREF_PANE_SRC=/Library/Internet\ Plug-       Ins/JavaAppletPlugin.plugin/Contents/Home/lib/deploy/JavaControlPanel.prefpane
if [ ! -h "${PREF_PANE_DEST}/${PREF_PANE_NAME}" ]; then
    ${LN} -s "${PREF_PANE_SRC}" "${PREF_PANE_DEST}"
${CHOWN} -R root:wheel "${PLUGIN_FILEPATH}"

Mountain Lion with Java 7 alone

You're on the right track … 

Without installing Java 6

… prompts to install, as described in the question, are to be expected.

So my short answer is yes, you can have Java 7 alone; but not without an installation of Java 6.


  1. allow Apple's installation of Java
  2. remove, from the two directories below, the version(s) of Java that are no longer required:



(For a case such as this, I reckon you can safely ignore the usual advice to not interfere with /System stuff.)

  • 2
    Java 7 is installed under /Library/Java/JavaVirtualMachines while Java 6 is under /System/Library/Java/JavaVirtualMachines Deleting 1.6.0.jdk from /System/Library/Java/JavaVirtualMachines results in the installation dialog poping up again. What seems to work is to make a symlink 1.6.0.jdk (under /System/...) to the 1.7.0.jdk (under /Library/...). Java Programs that do not check the Java version run fine (Java Preferences blocks at start as it seems to check if Java 5 or 6 is installed)
    – Nicolas
    Commented Jul 31, 2012 at 18:46
  • Cool – would you like to add your own answer? Please vote mine down – I won't take offence – the guess was clearly incorrect for the question, a vote down will help other users to not make similarly mistaken guesses for Java-related issues. Commented Jul 31, 2012 at 19:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .