37

I need to run Eclipse Kepler on Mac OS through a JDK 1.7 (This is required by the PyDev plugin).

The problem is that although I have managed to install the 1.7 jdk and configured the eclipse.ini to use it I get the error

The JVM shared library "/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin../jre/lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol.

UPDATE smart people here https://github.com/joeferner/node-java/issues/90 claim it is enough to add JNI to the JVMCapabilities in the info.plist file like

<key>JVMCapabilities</key>
   <string>JNI</string>

But I tried it and it does not work in my case

Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84

4 Answers4

58

Right click on the Eclipse icon and select 'show package contents'. Inside the contents directory you'll find a file called 'Info.plist'. Scroll down to the bottom of the file till you find this

<key>Eclipse</key>
    <array>
        <!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
                or add a VM found via $/usr/libexec/java_home -V
          <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java</string>
          <string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
        -->

Notice the commented out section. Move the jdk path declaration out of the comments section. It should look like this now.

<key>Eclipse</key>
    <array>
      <string>-vm</string><string>/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/bin/java</string>
        <!-- to use a specific Java version (instead of the platform's default) uncomment one of the following options,
                or add a VM found via $/usr/libexec/java_home -V
          <string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>
        -->

Last step, browse to /Library/Java/JavaVirtualMachines and check the jdk package name present there. Replace the jdk version in the above command with that.

/Library/Java/JavaVirtualMachines/{your_jdk_package_name}/Contents/Home/bin/java

Optional: On some machines you may have to close the finder after you've done all this, navigate to the eclipse folder and click on eclipse again for it to work.

Shan
  • 1,138
  • 17
  • 32
  • i had problem running Eclipse Luna on my mac OS X this fixed the problem for me! thanks a lot :) .. just to make sure you specify the correct path of Java on your machine use this command : /usr/libexec/java_home – maths Oct 04 '14 at 06:41
  • 1
    I thought it will eat lot of my time when I see this error, this simple steps fixed it in few minutes, thank you so much – Thamilan S Mar 13 '15 at 06:05
  • 1
    @Shan, it worked for me. I am just wondering why eclipse was not able to detect the correct jdk path. Maybe because I first tried to install eclipse and then I installed JRE 1.8 and JDK 1.8. I am new to Java world - that's why the order got reversed. I thought that when you install eclipse, everything will get installed. I am coming from Microsoft Visual Studio experience. – matrix Aug 19 '15 at 02:18
  • When I change, it gives me a ' "Eclipse" is damaged and can't be opened' error. Is it possible that the newer version of eclipse installations are codeSigned and changing the Info.plist fails validation. Is there a way to avoid this failure ? – user1055761 Feb 11 '18 at 21:53
  • My mac also does not allow me to modify the package contents. – Cheetaiean Dec 21 '19 at 20:01
  • This helped me run Eclipse Memory Analyzer. In "/Applications/mat.app/Contents/Info.plist", I added: -vm/Users/rrajvija/.sdkman/candidates/java/current/bin/java – Loner Dec 14 '22 at 13:37
15

Just for those who may have been stuck after doing both tasks described above and still seeing the same error message: I was certain that I had downloaded 64-bit Eclipse, but it turns out I had the 32-bit version. After downloading 64-bit, everything worked!

tobylaroni
  • 843
  • 8
  • 16
0

I had a perfectly working Eclipse Luna, and started getting this error while trying to upgrade to Java 8 (and updating jre, jdk etc). Shan's solution didn't work for me. So I just downloaded and installed latest Eclipse. It's working fine. Saves the time of debugging and fiddling around.

aalosious
  • 578
  • 6
  • 11
0

Seems like Eclipse [Apache Directory Studio] needs to be recompiled for aarch64. Eclipse has always been a challenge on all platforms, including linux.

EMR
  • 31
  • 4