Wednesday, December 18, 2013

Eclipse does not contain the JNI_CreateJavaVM - Mac OS X (10.9) Mavericks

Based on a recent experience, I thought it would be useful to post this blog for others who might also be struggling with this particular error message. After the Mac OS X Mavericks (10.9) upgrade, I hit the following error message from Eclipse Kepler (4.3.1) 32-bit
The JVM shared library "/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/../jre/lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol.
Also, there is another error message you might receive from Eclipse:
To open “Eclipse.app” you need a Java SE 6 runtime. Would you like to install one now?
I read through this bug report at eclipse.org - https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361 and that gave me some ideas as to how to workaround my Eclipse on Mavericks issues. Easy solution, download & install the Oracle JDK 7 and make sure to use the 64-bit version of Kepler. I have had Java 7 on the machine for a while and Java 8. I have historically used the 32-bit version of Eclipse which worked great with Java 6 which was the default from the Mac OS X perspective. Here is what I think happened, Mac OS X Lion (10.7) included Apple's Java 6 JRE, with Mac OS X Mavericks (10.9) it is no longer included. The Apple Java 6 supported 32-bit & 64-bit with a command line switch, Eclipse Juno & Kepler were seemingly able to handle that scenario. Now, Java 7 comes directly from Oracle and is installed separately on my box. In order to address the "you need a Java SE 6 runtime" specifically, I also needed to update your Info.plist in the JDK7 at /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Info.plist with the following in the JVMCapabilities section:
                JVMCapabilities
                
                        CommandLine
                        JNI
                        BundledApp
                        WebStart
                        Applets
                
Once the changes to Info.plist have been made you will need to reboot for it to take effect. Some other settings that might be important: JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home And I do not recall making any changes to Eclipse.ini that mattered, what follows is what I have right now on my machine, provided in case there is something tweaked in your installation. EDIT: It turns out that I did need to update my eclipse.ini, eclipse was picking up a Java 8 installation that I had and I needed to force it back to Java 7 as it was causing some other problems. Eclipse.ini for the 64-bit installation of Eclipse (underneath Eclipse.app-Contents-MacOS)
-startup
../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.standard.product
--launcher.defaultAction
openFile
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.6
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
-XX:MaxPermSize=256m
-Xms40m
-Xmx512m
-Xdock:icon=../Resources/Eclipse.icns
-XstartOnFirstThread
-Dorg.eclipse.swt.internal.carbon.smallFonts
Also, I did make the change recommended at Eclipse.org/downloads. It should be noted that you won't actually see something named "gatekeeper" in the UI.
Hopefully that helps, I spent plenty of time using Google looking at Bugzilla and StackOverflow entries but could not find something like this blog post that helped me address both issues (64-bit required, missing Java SE 6 runtime).

4 comments:

  1. I got to thank you man for those tips !

    ReplyDelete
  2. I had a similar problem that was solvable by editing Info.plist, but I also found that adding empty folders at “/System/Library/Java/JavaVirtualMachines/1.6.0.jdk” and “/System/Library/Java/Support/Deploy.bundle” caused OS X to use the Oracle JDK without modification.

    ReplyDelete
  3. How do I access the info.plist

    ReplyDelete
  4. The Info.plist file is editable via a regular text editor. I use Text Wrangler and TextMate, both of which show up under the Open With context menu (right-click on file).

    ReplyDelete