mrblippy
mrblippy

Reputation: 311

Eclipse still using java 6 as jre on Mac OSX

I have installed Eclipse SDK 3.7.1 on my mac, which is running mac osx 10.8.4. I am trying to get eclipse to use java 7, which is installed to /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/ But when I view eclipse's installation details it's still using to my old java 6 installation. Even after adding -vm /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java to the eclipse.ini file.

Also edited the Info.plist file to point to java 7

Anyone have any suggestions here? I'm completely out of ideas.

Please note: I am a newbie with macs. Any suggestions, big or small would be greatly appreciated :)

Contents of Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

<dict>
    <key>CFBundleExecutable</key>
        <string>eclipse</string>
    <key>CFBundleGetInfoString</key>
        <string>Eclipse 3.7 for Mac OS X, Copyright IBM Corp. and others 2002, 2011. All rights reserved.</string>
    <key>CFBundleIconFile</key>
        <string>Eclipse.icns</string>
    <key>CFBundleIdentifier</key>
        <string>org.eclipse.eclipse</string>
    <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
    <key>CFBundleName</key>
        <string>Eclipse</string>
    <key>CFBundlePackageType</key>
        <string>APPL</string>
    <key>CFBundleShortVersionString</key>
        <string>3.7</string>
    <key>CFBundleSignature</key>
        <string>????</string>
    <key>CFBundleVersion</key>
        <string>3.7</string>
    <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
    <key>CFBundleLocalizations</key>
        <array>
            <string>ar</string>
            <string>cs</string>
            <string>da</string>
            <string>el</string>
            <string>en</string>
            <string>es</string>
            <string>de</string>
            <string>fi</string>
            <string>fr</string>
            <string>hu</string>
            <string>it</string>
            <string>iw</string>
            <string>ja</string>
            <string>ko</string>
            <string>nl</string>
            <string>no</string>
            <string>pl</string>
            <string>pt_BR</string>
            <string>pt</string>
            <string>ru</string>
            <string>sv</string>
            <string>tr</string>
            <string>zh_HK</string>
            <string>zh_TW</string>
            <string>zh</string>
        </array>

    <key>Eclipse</key>
        <array>
            <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java</string>
            <string>-keyring</string><string>~/.eclipse_keyring</string>
            <string>-showlocation</string>
            <!-- WARNING:
                If you try to add a single VM argument (-vmargs) here,
                *all* vmargs specified in eclipse.ini will be ignored.
                We recommend to add all arguments in eclipse.ini
             -->
        </array>
</dict>

</plist>

Upvotes: 6

Views: 14454

Answers (5)

Waterloo Stu
Waterloo Stu

Reputation: 93

In case anyone is encountering this too, for somereason my Java 7 seemed to be installed at the following path:

/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home

My Java 6 install was here: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

The Java 6 path makes some sense, and agrees with teh paths I've seen people mention on this particular issue, but no idea why the Java 7 path would be like that.

Upvotes: 1

adriannieto
adriannieto

Reputation: 352

This question is answered in this topic How do I run Eclipse using Oracle's new 1.7 JDK for the Mac?

My approach was this:

After installing Oracle JRE and JDK, open Info.plist inside Eclipse.app(right click, show contents) and paste after "Eclipse" "-vm/System/Library/Frameworks/JavaVM.framework/JavaVM"

Mine looks like this:

<key>Eclipse</key> <array>
     <string>-vm</string><string>/System/Library/Frameworks/JavaVM.framework/JavaVM</string>
     <string>-keyring</string><string>~/.eclipse_keyring</string>
     <string>-showlocation</string> </array>

If you do that, you will not have to update the file after upgrading JRE.

Upvotes: 3

Anya Shenanigans
Anya Shenanigans

Reputation: 94584

If you're trying to get the VM that eclipse runs under to change then it's the Info.plist you need to modify, and it should be changed in the section that says how to specify the different VMs. In my case I changed it to run with the 1.6 VM using:

<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java</string> 

in the eclipse array of the plist.

if you want to force a specific 1.7 VM, you use:

<string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java</string>

Note, this is not the eclipse.ini, this is the Eclipse.app/Contents/Info.plist. This is because of the slightly different way that the Mac launches eclipse from other platforms

Upvotes: 7

schtever
schtever

Reputation: 3250

Try putting the path to the JDK bin directory as the argument to the -vm parameter. In other words, just trim the "/java" off of what you have now.

Upvotes: 0

Juned Ahsan
Juned Ahsan

Reputation: 68715

In eclipse:

Go to Menu-> Window -> Preferences -> Java -> Installed JREs -> Remove the old JRE -> Add new JRE

Upvotes: 1

Related Questions