简体   繁体   English

Mac OS,JDK1.7(和1.8)不包含JNI_CreateJavaVM符号

[英]Mac OS, JDK1.7 (and 1.8) does not contain the JNI_CreateJavaVM symbol

I need to run Eclipse Kepler on Mac OS through a JDK 1.7 (This is required by the PyDev plugin). 我需要在Mac OS上通过JDK 1.7运行Eclipse Kepler(这是PyDev插件所必需的)。

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 问题是虽然我已经设法安装了1.7 jdk并配置了eclipse.ini来使用它但我得到了错误

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. JVM共享库“/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin../jre/lib/server/libjvm.dylib”不包含JNI_CreateJavaVM符号。

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 更新智能人员https://github.com/joeferner/node-java/issues/90声称将JNI添加到info.plist文件中的JVMCapabilities就足够了

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

But I tried it and it does not work in my case 但是我尝试了它并且它在我的情况下不起作用

Right click on the Eclipse icon and select 'show package contents'. 右键单击Eclipse图标,然后选择“显示包内容”。 Inside the contents directory you'll find a file called 'Info.plist'. 在内容目录中,您将找到名为“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. 将jdk路径声明移出注释部分。 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. 最后一步,浏览到/ Library / Java / JavaVirtualMachines并检查其中的jdk包名称。 Replace the jdk version in the above command with that. 用上面的命令替换上面命令中的jdk版本。

/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. 可选:在某些机器上,您可能必须在完成所有操作后关闭取景器,导航到eclipse文件夹并再次单击eclipse以使其工作。

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. 只是对于那些在完成上述任务并且仍然看到相同的错误消息后可能被卡住的人:我确信我已经下载了64位Eclipse,但事实证明我有32位版本。 After downloading 64-bit, everything worked! 下载64位后,一切正常!

I had a perfectly working Eclipse Luna, and started getting this error while trying to upgrade to Java 8 (and updating jre, jdk etc). 我有一个完美的Eclipse Luna工作,并在尝试升级到Java 8(并更新jre,jdk等)时开始出现此错误。 Shan's solution didn't work for me. Shan的解决方案对我不起作用。 So I just downloaded and installed latest Eclipse. 所以我刚下载并安装了最新的Eclipse。 It's working fine. 它工作正常。 Saves the time of debugging and fiddling around. 节省调试和摆弄的时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM