6

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>
mrblippy
  • 311
  • 2
  • 3
  • 10
  • 1
    http://stackoverflow.com/questions/7861424/how-to-change-workspace-jre-in-eclipse – kosa Jul 11 '13 at 03:03
  • 1
    I tried doing this without success about a year ago. Things may be different now, but I've pretty much given up on it. I don't really need Eclipse to be running in Java 7 anyway, as long as it supports Java 7 projects. Here's an answer that may address your issue - http://stackoverflow.com/questions/10352715/how-do-i-run-eclipse-using-oracles-new-1-7-jdk-for-the-mac/10374886#10374886 – Jack Leow Jul 11 '13 at 04:57
  • Make sure you are using 64bit Eclipse. Had no luck running 32bit one on 1.7 jvm with any options. – tuxSlayer Nov 14 '13 at 19:41

5 Answers5

7

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

Anya Shenanigans
  • 91,618
  • 3
  • 107
  • 122
  • Thanks so much, but it's still not working. Might attach my Info.plist life for you to look at if that's ok? – mrblippy Jul 11 '13 at 03:51
  • Sure you can attach your info.plist. Just make sure that you're referencing the proper VM - i.e. use `/usr/libexec/java_home -V` to determine installed VMs and reference the right one – Anya Shenanigans Jul 11 '13 at 05:13
3

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.

Community
  • 1
  • 1
adriannieto
  • 352
  • 2
  • 7
1

In eclipse:

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

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
  • Thanks for the help. Have done that, and the only installed JRE is now the java 7 one. But when i go to eclipse->About Eclipse SDK->configuration tab the java.home ect are still pointing to my old java 6 installation – mrblippy Jul 11 '13 at 03:13
1

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.

Waterloo Stu
  • 93
  • 1
  • 7
0

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.

schtever
  • 3,210
  • 16
  • 25