无法加载 JNI 共享库 (JDK)
当我尝试打开 Eclipse 时,弹出对话框指出:
无法加载 JNI 共享库“C:/JDK/bin/client/jvm.dll”
。
在此之后,Eclipse 强制关闭。
我想提出以下几点:
- 我检查了该路径上是否存在任何东西。它确实存在。
- 我的 Eclipse 和 Java SE Development Kit 都是 64 位。我检查了我的系统,它可以处理 64 位。
- 我在Google和StackOverflow上搜索过这个问题,找到的唯一答案是下载32位版本的JDK和Eclipse。
下载 32 位版本是我最后的选择。
有什么建议可以解决这个问题?
When I try opening Eclipse, a pop-up dialog states:
Failed to load the JNI shared library "C:/JDK/bin/client/jvm.dll"
.
Following this, Eclipse force closes.
Here are a few points I'd like to make:
- I checked to see if anything exists on that path. It does exist.
- My Eclipse and Java SE Development Kit are both 64-bit. I checked my system, and it can handle 64-bit.
- I've searched for this problem on Google and StackOverflow, and the only answer I found was to download the 32-bit versions of JDK and Eclipse.
Downloading the 32-bit versions is something I only want to do as a very last resort.
What would be suggested to solve this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(30)
您需要一个
64 位
三重奏:64 位
操作系统64 位
Java64 位
EclipseYou need a
64-bit
trio:64-bit
OS64-bit
Java64-bit
Eclipse操作系统、JDK 和 Eclipse 的工作配对:
32 位
操作系统 |32 位
JDK |32 位
Eclipse(仅限 32 位)64 位
操作系统 |32 位
JDK |32 位
Eclipse64 位
操作系统 |64 位 JDK
|64bit
Eclipse(仅限 64 位)我安装了多个 JDK 和 JRE。
他们每个人在 PATH 变量中都有自己的条目,所有这些或多或少都在工作。
从 PATH 变量来看,有些安装完全没有用,因为它们从未被使用过。当然,如果需要,可以从 Eclipse 中手动引用“非活动”Java,但我从未这样做过,所以我确实不需要它们。 (至少我当时是这么认为的......)
我清理了混乱,卸载了所有当前的Java,只安装了JDK + JRE 1.7 64位。
其中一个 Eclipse“安装”随后失败,并出现
无法加载 JNI 共享库
以及相对于新安装的 JDK 的给定路径,它认为jvm.dll
是是。失败的 Eclipse 是我所有 IDE 中唯一一个在我的全 64 位设置上仍然是 32 位版本的。
添加 VM 参数,就像经常发生的那样提到,在 eclipse.ini 中对我来说没有用(因为我只有错误的 JDK/JRE 相关。)
我也无法找到如何检查这个 Eclipse 是否是一个32 位或 64 位版本(我无法在 任务管理器 中查找它,因为此 Eclipse“安装”不会由于我设置它已经有一段时间了,所以我也不记得它的版本了。)
如果你使用较新的 JDK 和较旧的 JRE 您可能也会遇到麻烦,但它更有可能是
java出现.lang.UnsupportedClassVersionError
,IIRC。Working pairings of OS, JDK and Eclipse:
32-bit
OS |32-bit
JDK |32-bit
Eclipse (32-bit only)64-bit
OS |32-bit
JDK |32-bit
Eclipse64-bit
OS |64-bit JDK
|64bit
Eclipse (64-bit only)I had several JDKs and JREs installed.
Each of them had their own entry in the PATH variable, all was working more or less.
Judging from the PATH variables, some installations were completely useless, since they were never used. Of course, the "inactive" Javas could be referenced manually from within Eclipse if I needed, but I never did that, so I really did not need them. (At least I thought so at that time...)
I cleaned up the mess, deinstalled all current Java's, installed only JDK + JRE 1.7 64-bit.
One of the Eclipse 'installations' failed afterwards with the
Failed to Load the JNI shared Library
and a given path relative to the fresh installed JDK where it thought thejvm.dll
to be.The failing Eclipse was the only one of all my IDEs that was still a 32-bit version on my otherwise all-64-bit setup.
Adding VM arguments, like so often mentioned, in the
eclipse.ini
was no use in my case (because I had only the wrong JDK/JRE to relate to.)I was also unable to find out how to check if this Eclipse was a 32-bit or 64-bit version (I could not look it up in the Task Manager, since this Eclipse 'installation' would not start up. And since it had been a while since I had set it up, I could not remember its version either.)
In case you use a newer JDK and a older JRE you might be in for trouble, too, but then it is more likely a
java.lang.UnsupportedClassVersionError
appears, IIRC.确保您的 eclipse.ini 文件包含以下行。
以我的
eclipse.ini
为例:使用 64 位或 32 位操作系统和 Eclipse 保持相同并配置
eclipse.ini
< /强>。您的
eclipse.ini
文件可以在 eclipse 文件夹中找到。Make sure your
eclipse.ini
file includes the following lines.My
eclipse.ini
for example:Use OS and Eclipse both 64 bit or both 32 bit keep same and config
eclipse.ini
.Your
eclipse.ini
file can be found in your eclipse folder.我遇到了同样的问题,
我通过从
http://www.java 安装 64 位 JVM 解决了这个问题。 com/en/download/manual.jsp
I had same problem
I resolved it by installing 64 bit JVM from
http://www.java.com/en/download/manual.jsp
此错误意味着 Eclipse 的体系结构与 Java 运行时的体系结构不匹配,即如果一个是 32 位,则另一个必须相同,而不是 64 位。
最可靠的修复方法是在 eclipse.ini 中指定 JVM 位置:
重要:这两行必须位于 -vmargs之前。不要使用引号;允许有空格。
This error means that the architecture of Eclipse does not match the architecture of the Java runtime, i.e. if one is 32-bit the other must be the same, and not 64-bit.
The most reliable fix is to specify the JVM location in eclipse.ini:
Important: These two lines must come before -vmargs. Do not use quotes; spaces are allowed.
另一个选择是:
创建 Eclipse.exe 的快捷方式。打开快捷方式并将目标更改为:
对于您的安装,请确保位置指向正确的 Eclipse 安装目录和正确的
javaw.exe
安装目录。(当然,64/32 位版本的 Eclipse 和 Java 需要相同。)
Another option is:
Create a shortcut to the Eclipse.exe. Open the shortcut and change the target to:
For your installation, make sure the locations point to the correct Eclipse installation directory and the correct
javaw.exe
installation directory.(The 64/32 bit versions of Eclipse and Java need to be the same, of course.)
我安装了多个版本的 Java,包括 Sun JDK 和 Java。 JRockit,32 位和 64 位等,在全新安装 64 位 Eclipse for Java EE (JUNO) 时遇到了这个问题。
什么不起作用:
Peter Rader 建议的 64 位三重奏:
我在 64 位操作系统 (Windows 7) 上使用 64 位 Eclipse。
我确保 Sun JDK 7 64 位是默认的 java 版本。当我从命令行(cmd.exe)输入“java -version”时,返回了 Sun JDK 7 64 位...
这并没有解决我的问题。
DID 的工作原理:
按照 Jayesh Kavathiya 的建议向 eclipse.ini 添加 -vm 选项:
我向 eclipse.ini 添加了以下内容:
注意:
我不必卸载任何不同版本的 JDK 或JRE 我的机器上有。
I have multiple versions of Java installed, both Sun JDK & JRockit, both 32 bit and 64-bit, etc. and ran into this problem with a fresh install of 64-bit Eclipse for Java EE (JUNO).
What did NOT work:
64-bit trio as suggested by Peter Rader:
I'm using 64-bit Eclipse on 64-bit OS (Windows 7).
I ensured Sun JDK 7 64-bit was the default java version. When I typed "java -version" from command line (cmd.exe), Sun JDK 7 64-bit was returned...
This did not resolve the problem for me.
What DID work:
Adding -vm option to eclipse.ini as suggested by Jayesh Kavathiya:
I added the following to eclipse.ini:
Note:
I did not have to uninstall any of the various versions of JDK or JRE I have on my machine.
对于丢失的
jvm.dll
文件,我们可以在eclipse.ini
文件中提供dll文件的路径,如下所示,删除路径中的任何空格和双引号。
当我删除引号和空格时,它对我有用。
我希望它能帮助某人。
For a missing
jvm.dll
file, we can provide the path of the dll file ineclipse.ini
file asHere it is important to remove any space in the path and the double quotes.
It worked for me when i removed the quotes and space.
I hope it helps someone.
我有类似的问题。通过执行以下操作解决了。
我安装了两个版本的 Java,但 Eclipse 一直尝试使用 32 位版本。
I had a similar problem. It was solved doing the following.
I have both versions of Java installed, but Eclipse kept trying to use the 32-bit one.
当然,您需要有兼容版本的 JDK 和 Eclipse,但您还需要在 eclipse.ini 文件中添加以下行:
将它们作为 eclipse 的前两行。 ini 文件。
Sure, you need to have a compatible version of JDK and Eclipse, but you also need to add in the
eclipse.ini
file the below lines:Make them the first two lines of your
eclipse.ini
file.正如许多人已经提到的,对于 Eclipse 和 Java。您不能混淆 32 位和 64 位。由于 Eclipse 不使用 JAVA_HOME,因此您可能必须在启动 Eclipse 之前更改 PATH,以确保您不仅使用适当版本的 Java,而且还使用 32 位或 64 位(或按照 Jayath 的说明修改 INI 文件)。
如果您从公司共享安装 Eclipse,则应确保您可以知道要解压缩的 Eclipse 版本,并将其解压缩到相应的 Program Files 目录以帮助跟踪哪个版本,然后进行更改PATH(永久通过(Windows)控制面板 -> 系统或设置 PATH=/path/to/32 或 64bit/java/bin;%PATH% (如果您可以创建一个批处理文件不想设置记住,32 位位于程序文件 (x86) 中,
如果不确定,只需启动 Eclipse,如果出现错误,请将 PATH 更改为其他“位”版本的 Java,然后重试,然后将 Eclipse 目录移动到相应的 Program Files 目录。
As many folks already alluded to, this is a 32 vs. 64 bit problem for both Eclipse and Java. You cannot mix up 32 and 64 bit. Since Eclipse doesn't use
JAVA_HOME
, you'll likely have to alter your PATH prior to launching Eclipse to ensure you are using not only the appropriate version of Java, but also if 32 or 64 bit (or modify the INI file as Jayath noted).If you are installing Eclipse from a company-share, you should ensure you can tell which Eclipse version you are unzipping, and unzip to the appropriate Program Files directory to help keep track of which is which, then change the PATH (either permanently via (Windows) Control Panel -> System or set
PATH=/path/to/32 or 64bit/java/bin;%PATH%
(maybe create a batch file if you don't want to set it in your system and/or user environment variables). Remember, 32-bit is in Program files (x86).If unsure, just launch Eclipse, if you get the error, change your PATH to the other 'bit' version of Java, and then try again. Then move the Eclipse directory to the appropriate Program Files directory.
上面的答案让我非常着迷,因此我决定与操作系统一起试运行所有可能的组合,Eclipse 和 JVM 三人组。无论如何,无论谁正在挖掘并阅读我的文章,请检查以下内容作为热点(我是 Windows 7 用户)。
您知道Program Files和Program File (x86)是两个不同的文件夹...x86代表32位版本的程序,前者是 64 位版本。
如果您安装了多个版本的 Java,并且具有不同的位数和发行版本,对于如此多的开源IDE、管理器、管理控制台来说,这是必然会发生的,最好的选择是为了直接在 eclipse.ini 文件中设置 VM 参数。如果不这样做,Eclipse 会发疯并尝试搜索自身,这不太好。
The answers above me got me tempted so much, that I decided to dry run all the possible combinations with OS, Eclipse and JVM trio. Anyway, whoever is digging down and reading my post, check the following as a hot spot (I am Windows 7 user).
You understand Program Files and Program File (x86) are two different folders... x86 stands for the 32-bit version of programs and the former is the 64-bit version.
If you have multiple versions of Java installed with different bitness and release versions, which is bound to happen with so many open source IDEs, managers, administrative consoles, the best option is to set the VM argument directly in the
eclipse.ini
file. If you don't, Eclipse will go crazy and try searching itself which is not good.或者,获取相同“位”版本的 JRE 和 Eclipse,然后创建一个新的快捷方式使用以下目标(替换已安装的 JRE 和 Eclipse 位置/路径):
这应该可以解决问题。
Alternatively, get the same "bit" version of JRE and Eclipse and then create a new shortcut with the below target (replace the installed JRE and Eclipse location/path):
That should do the trick.
您可以解决这个问题,就像许多其他问题一样。您需要 Eclipse 和 JDK 是 32 位或两者都是 64 位< /强>。操作系统的架构并不重要,而其他操作系统仍采用相同类型的架构。
You can solve that problem as many other replicated. You need that Eclipse and the JDK be 32-bits or both on 64-bits. The architecture of the OS doesn't matter while the others remains on the same type of arquitecture.
解决此问题的简单方法之一是将已安装的 JDK 中的 jre 文件夹复制到 Eclipse 安装文件夹中。确保您复制的 JDK 与您安装的 Eclipse 具有相同的体系结构。
我必须以这种方式配置我的机器,因为我在我的机器上运行 Eclipse 和 Appcelerator Titanium Studio 。 Studio需要32位Java,而Eclipse需要64位。
One of the easy ways to resolve it is to copy the
jre
folder from installed the JDK into the Eclipse installation folder. Make sure that JDK you copy from is the same architecture as your Eclipse installation.I had to configure my machine that way, because I run both Eclipse and Appcelerator Titanium Studio on my machine. The Studio needs 32-bit Java, while Eclipse needs 64-bit.
是的,只需确保您的 Eclipse 和 JDK 版本均为 64 位即可。只是为了确保一切正确,卸载了 JDK 并将其安装在 Program Files 中,而不是 Program Files (x86) 中。至少这解决了我的问题。
Yes, just make sure your versions of Eclipse and JDK are both 64-bit. Just to make sure everything is correct uninstalled JDK and install it in Program Files and not in Program Files (x86). At least that resolved my problem.
只需检查 PATH 环境变量即可。在我的电脑中 - > 属性 -> 高级系统设置 -> 环境变量 -> (左上方窗口““PC 的某个名称”的用户变量”)只需检查 PATH 变量。如果它不存在,请使用以下命令创建它 -- > C:\Program Files (x86)\Java\jre7\bin <--
更新 Eclipse 后,我遇到了同样的问题。我发现该路径要求 64 位版本,但我在 diff 路径中有 32 位版本。这对我很有帮助。 PS:我有64位操作系统,32位JRE和32位Eclipse。一切正常:)
Just check the PATH environment variable. In My Computer - > Properties -> Advanced System settings -> Environment Variables -> (left upper window "User Variables for "some name of PC"" ) just check the PATH variable. If it doesn't exist create it with the following -- > C:\Program Files (x86)\Java\jre7\bin <--
I was faced with the same problem after had updated my Eclipse. I've found that the path asked 64-bit version, but I had the 32-bit in dif path. It was helpful for me. P.S.: I have a 64-bit OS, 32-bit JRE and 32-bit Eclipse. All works fine :)
您应该卸载所有旧的 [JRE][1],然后安装最新的...我遇到了同样的问题,现在我解决了。我:
最好安装 Jre 6 32 位。它确实有效。
You should uninstall all old [JREs][1] and then install the newest one... I had the same problem and now I solve it. I've:
Better install Jre 6 32 bit. It really works.
从网站下载 64 位 JVM 并手动安装并更新系统路径变量。这解决了问题。
(x86)\Java\jre7"
“C:\Program Files\Java\jre7”并将此路径更新到系统后
路径变量它起作用了。
Downloaded 64 bit JVM from site and installed it manually and updated the system path variable. That solved the issue.
(x86)\Java\jre7"
"C:\Program Files\Java\jre7" and after updating this pate to system
path variable it worked.
谢谢misterfrb,我意识到 Eclipse 给出了这个错误,因为我刚刚安装了 Oracle 10g Developer suite,它正在
C:\DevSuiteHome_1
文件夹中查找jvm.dll
文件(我必须已选择再次安装 JDK 以及开发人员套件)。从路径变量中删除 DevSuiteHome 行并添加 64 位
jvm.dll
的更正位置(不确定这是否有必要,没有尝试过)后,Eclipse 再次工作,并且开发人员套件仍然如此。Thank you misterfrb, I realised that Eclipse was giving this error, because I had just installed Oracle 10g Developer suite, and it was looking for the
jvm.dll
file in theC:\DevSuiteHome_1
folder (I must have opted to install JDK again along with developer suite).After removing the DevSuiteHome lines from the paths variable and adding the correction location for 64-bit
jvm.dll
(not sure if this was necessary, didn't try without), Eclipse worked again, and Developer suite still does too.简单,我有一个 64 位操作系统、32 位 Eclipse 以及 JDK 32&安装了 64 位...我刚刚卸载了 64 位 JDK,Eclipse 工作正常..
Simple, I have a 64-bit OS, 32-bit Eclipse and both JDK 32 & 64 installed... I just uninstalled the 64-bit JDK and Eclipse is working fine..
从 Java 6 升级到 Java 7 后,我遇到了同样的问题。删除 Java 6(64 位)并重新安装 Java 7(64 位)后,Eclipse 工作了。 :)
I had the same issue after upgrading from Java 6 to Java 7. After I removed Java 6 (64 bit) and reinstalled Java 7 (64 bit), Eclipse worked. :)
开头的两行中添加 -vm 参数及其值至关重要
在 eclipse.ini -vm
C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe
It is crucial to add the -vm parameter and its value on 2 lines AT THE BEGINNING of the eclipse.ini
-vm
C:\Program Files\Java\jdk1.7.0_45\bin\javaw.exe
您已在环境变量中更改了 JAVA_HOME 和 PATH 的正确版本。
You have change proper version of the JAVA_HOME and PATH in environmental variables.
我想为这个错误提供另一种解决方案,特别是对于那些想要在一个系统中使用 32 位和 64 位 Eclipse 的人。
Eclipse 将使用
jre
子目录中的 JRE/JDK 启动(如果存在)。 (STS 或其他基于 Eclipse 的 IDE 也支持此功能...)解决方案是使用 Windows Vista 或更新版本中存在的
mklink.exe
命令创建目录连接(junction.exe 为 Windows 2000/XP 提供类似功能)打开命令行窗口并执行以下命令:
当然,如果Eclipse是针对64位Windows的,那么
JDK/JRE
的架构必须相同。假设:
Eclipse for windows x86_64
安装在 d:\devTool\eclipseJDK for windows x64
安装在 C:\Program Files\Java\jdk1.8.0创建
jre
文件夹的命令为:顺便说一句,删除目录连接将不会删除任何文件。如果创建了错误的链接,可以使用文件资源管理器或 rmdir 命令将其删除。
I want to previde another solution for this error, especially for who want to use 32-bit and 64-bit Eclipse in one system.
Eclipse will startup using the JRE/JDK in
jre
sub-directory if it exists. (STS or other eclipse based IDE also support this feature...)The solution is create directory junction using
mklink.exe
command which exist in windows vista or newer version (junction.exe offer similar function for Windows 2000/XP)Open the command line windows and exeute following command:
Of course, if the Eclipse is for 64-bit Windows, the architecture of
JDK/JRE
must be the same.Assume:
Eclipse for windows x86_64
is installed in d:\devTool\eclipseJDK for windows x64
is installed in C:\Program Files\Java\jdk1.8.0The command for creating the
jre
folder will be:BTW, delete directory junction will NOT delete any file. If you create a wrong link, you can delete it using file explorer or
rmdir
command.确保您以管理员权限启动 Eclipse。
Make sure you are starting Eclipse with Administrator rights.
如果您使用整个 64 位三重奏,但它仍然无法工作(我在 Intellij Idea 中启动 Android Monitor 时遇到了这个问题),则可能使用了错误的 jvm.dll ,这与您的 java 期望的相反。只需按照以下步骤操作:
在 JRE 目录中找到 jvm.dll:
C:\Program Files\Java\jre7\server\bin\jvm.dll
在 JDK 目录中找到 jvm.dll:
c:\Program Files\Java\jdk1.7.0_xx\jre\bin\server\
将 JRE 目录中的
jvm.dll
复制到 JDK 目录中并覆盖JDK中的jvm.dll。不要忘记进行备份,以防万一。无需安装或卸载任何与Java相关的东西。
If you use whole 64-bit trio and it still doesn't work (I've come to this problem while launching Android Monitor in Intellij Idea), probably wrong jvm.dll is being used opposed to what your java expects. Just follow these steps:
Find the jvm.dll in your JRE directory:
C:\Program Files\Java\jre7\server\bin\jvm.dll
Find the jvm.dll in your JDK directory:
c:\Program Files\Java\jdk1.7.0_xx\jre\bin\server\
Copy the
jvm.dll
from JRE drectory into your JDK directory and overwrite the jvm.dll in JDK.Don't forget to make a backup, just in case. No need to install or uninstall anything related to Java.
我也有同样的情况。我有 64 位 Eclipse,但我的 JDK 是 32 位。所以我安装了64位版本,现在就可以了。
The same occurred to me. I had 64-bit Eclipse, but my JDK was 32-bit. So I installed the 64-bit version and it's OK right now.
我不知道为什么,但我已将 jre 安装到我的 c:\windows 目录中,并将 java.exe 和 javaw.exe 安装到我的 windows\system32 目录中。
显然,即使在将 -vm 标志添加到我的 eclipse.ini 文件之后,这些目录也获得了优先级。
从这里删除它们解决了我的问题。
I'm not sure why but I had the jre installed into my c:\windows directory and java.exe and javaw.exe inside my windows\system32 directory.
Obviously these directories were getting priority even AFTER adding the -vm flag to my eclipse.ini file.
Delete them from here fixed the issue for me.
在Eclipse的下载页面上,应该写“JRE 32位”或“JRE 64位”,而不是“Windows 32位”或“Windows 64位”。
请务必使用与您的 JDE 兼容的正确版本,如前面所回答的。
On the download page of Eclipse, it should be written "JRE 32 bits" or "JRE 64 bits" and not "Windows 32 bits" or "Windows 64 bits".
Be sure to use the correct version compatible with your JDE, as answered previously.