Java 必须有 JRE 或 JDK 才能运行 Eclipse。搜索以下位置后未找到JVM
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4419983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
A JRE or JDK must be available in order to run Eclipse. No JVM was found after searching the following locations
提问by David Smith
Eclipse is unable to open, have used eclipse before and has open before without a problem. Now I keep getting the following error message:
Eclipse无法打开,之前用过eclipse,之前打开过没有问题。现在我不断收到以下错误消息:
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
Java 运行时环境 (JRE) 或 Java 开发工具包 (JDK) 必须可用才能运行 Eclipse。搜索以下位置后未找到 Java 虚拟机:
Have gotten eclipse to open and work on projects before and won't open.
之前已经让 eclipse 打开并处理项目,但不会打开。
Here is a screen shot of what I keep getting:
这是我不断收到的屏幕截图:
回答by BalusC
You can explicitly tell Eclipse where to find it. Open eclipse.ini
and add the following lines to the top of the file:
您可以明确地告诉 Eclipse 在哪里可以找到它。打开eclipse.ini
并将以下行添加到文件顶部:
-vm
/absolute/path/to/jre6/bin
Update: I just nailed down the root cause on my own Windows machine. The GlassFish installer complained with exactly the same error message and after digging in GlassFish forums, the cause was clear: a corrupt JRE install on a Windows machine. My JRE came along with the JDK and the Java 6 JDK installer didn't install the JRE properly somehow. A DLL file was missing in JDK's JRE installation. After I reinstalled the standalone JRE from http://java.com, overwriting the old one, the GlassFish installer continued and also Eclipse was able to start flawlessly without those two lines in eclipse.ini
.
更新:我刚刚确定了我自己的 Windows 机器上的根本原因。GlassFish 安装程序抱怨了完全相同的错误消息,在浏览 GlassFish 论坛后,原因很明显:Windows 机器上的 JRE 安装损坏。我的 JRE 与 JDK 一起出现,而 Java 6 JDK 安装程序没有以某种方式正确安装 JRE。JDK 的 JRE 安装中缺少 DLL 文件。在我从http://java.com重新安装独立 JRE 并覆盖旧的JRE 后,GlassFish 安装程序继续运行,而且 Eclipse 能够在没有这两行的情况下完美启动eclipse.ini
。
回答by VonC
It usually is because:
通常是因为:
- you indicated the wrong jvm path in your
-vm
argument: see this SO questionfor an concrete example. - the
eclipse.ini
got corrupted somehow (if it hasn't been modified, this isn't it, but if setting a jvm path doesn't work, ... I would replace theeclipse.ini
by one coming from a fresh installation just to be sure) - the java which eclipse search by default is no longer accessible (because the $PATH is no longer up-to-date)
- 您在您的
-vm
论点中指出了错误的 jvm 路径:有关具体示例,请参阅此SO 问题。 - 在
eclipse.ini
被损坏了不知何故(如果它没有被修改过,这不是,但如果设置一个JVM路径不工作,...我会更换eclipse.ini
一个从全新安装来只是要确定) - 默认情况下 eclipse 搜索的 java 不再可访问(因为 $PATH 不再是最新的)
More details on the wiki page "Finding a VM, Using JNI Invocation or Executing Java"
wiki 页面“查找 VM,使用 JNI 调用或执行 Java”的更多详细信息
No -vm specified
When no
-vm
is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path.
If java is found in either location, then we look for a jvm shared library (jvm.dll on window, libjvm.so on *nix platforms) relative to that java executable.
- If a jvm shared library is found we load it and use the JNI invocation api to start the vm.
- If no jvm shared library is found, we exec the java launcher to start the vm in a new process.
未指定 -vm
当
-vm
指定no时,启动器首先在eclipse根目录下的jre目录中查找虚拟机,然后在搜索路径中查找。
如果在任一位置都找到了 java,那么我们会查找与该 java 可执行文件相关的 jvm 共享库(window 上的 jvm.dll,*nix 平台上的 libjvm.so)。
- 如果找到一个 jvm 共享库,我们会加载它并使用 JNI 调用 api 来启动 vm。
- 如果找不到 jvm 共享库,我们执行 java 启动器以在新进程中启动 vm。
As mentioned in "FAQ How do I run Eclipse?":
如“常见问题解答如何运行 Eclipse?”中所述:
Eclipse DOES NOT consult the
JAVA_HOME
environment variable.
Eclipse 不咨询
JAVA_HOME
环境变量。
So I would check your $PATH, starting by n new shell sesion (whatever your OS is), typing 'java -version
' to see if it still returns anything.
所以我会检查你的 $PATH,从 n 个新的 shell 会话开始(无论你的操作系统是什么),输入 ' java -version
' 以查看它是否仍然返回任何内容。
回答by julioA
I had this problem too on a win7 machine. I wanted to update the jre with a jdk. So i deleted the jre folder and downloaded and unzipped the new jdk. The issue was i manually deleted the jre folder, when instead i should've uninstalled it. This leaves a bunch of registry entries that still point to the old jre. Somehow eclipse still wants to use the old jre. I couldn't uninstall the old java vm, i kept getting this error:
我在win7机器上也有这个问题。我想用 jdk 更新 jre。所以我删除了 jre 文件夹并下载并解压缩了新的 jdk。问题是我手动删除了 jre 文件夹,而我应该卸载它。这留下了一堆仍然指向旧 jre 的注册表项。不知何故,eclipse 仍然想使用旧的 jre。我无法卸载旧的 java vm,我不断收到此错误:
Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor
错误 1723。此 Windows 安装程序包有问题。无法运行此安装完成所需的 DLL。联系您的支持人员或软件包供应商
So i had to use this MS utility to fix the uninstall:
所以我不得不使用这个 MS 实用程序来修复卸载:
http://support.microsoft.com/kb/2438651/
http://support.microsoft.com/kb/2438651/
Then i had to install again the vm. I installed to the same location the original one was at, to avoid losing another hour! After that eclipse started correctly.
然后我不得不再次安装虚拟机。我安装到原来的位置,以免再浪费一个小时!之后日食正确启动。
Julio
胡里奥
回答by user1205577
I had the same problem and the issue was that I had a 32 bit version of Eclipse running on my 64 bit machine and it wanted the 32 bit version of JRE.
我遇到了同样的问题,问题是我的 64 位机器上运行的是 32 位版本的 Eclipse,它需要 32 位版本的 JRE。
I changed Program Files
to Program Files (x86)
in the eclipse.ini
file like so:
我换Program Files
到Program Files (x86)
了在eclipse.ini
像这样的文件:
-VM
C:Program Files (x86)\Java\jre6\bin
and that solved the problem.
这解决了问题。
You may want to just install the 64 bit Eclipse, but this will take care of the error.
您可能只想安装 64 位 Eclipse,但这会解决错误。
回答by rashini
I also had same problem when developing android applications using eclipse IDE. I solved it by removing all the java installations (I had java 6 and 7 both) and re-install only jdk 7.
我在使用 Eclipse IDE 开发 android 应用程序时也遇到了同样的问题。我通过删除所有 java 安装(我有 java 6 和 7)并仅重新安装 jdk 7 来解决它。
回答by QuadMachine
Here is how I fixed mine:
这是我修复我的方法:
find the location where your jre is installed. in my case, it was located at C:\Program Files\Java\jdk1.7.0_10
copy the jre folder and paste it where your eclipse files are located (where eclipse.exe is located).
找到安装 jre 的位置。就我而言,它位于 C:\Program Files\Java\jdk1.7.0_10
复制 jre 文件夹并将其粘贴到 eclipse 文件所在的位置(eclipse.exe 所在的位置)。
when you download eclipse, you get a .zip package containing eclipse.exe and all the other files needed to run eclipse but it is missing the jre files. so all you need to do is to find where jre folder is located on your hard drive and add it to the rest of the eclipse package.
当您下载 eclipse 时,您会得到一个 .zip 包,其中包含 eclipse.exe 和运行 eclipse 所需的所有其他文件,但它缺少 jre 文件。所以你需要做的就是找到 jre 文件夹在你的硬盘驱动器上的位置,并将它添加到 eclipse 包的其余部分。
回答by robert mac
I just had this problem and fixed it this way. I noticed the error message has jre in it not jre6 or jre7, so i copied jre6 from program files to eclipse folder then renamed it from jre6 to jre, then it worked :p
我刚刚遇到了这个问题并以这种方式修复了它。我注意到错误消息中包含 jre 而不是 jre6 或 jre7,所以我将 jre6 从程序文件复制到 eclipse 文件夹,然后将其从 jre6 重命名为 jre,然后它工作了:p
回答by user2221891
Did you install Java via the java.com web browser auto install? If so, then that's your problem! You need to to the "manual" install: http://www.java.com/en/download/manual.jsp
您是否通过 java.com Web 浏览器自动安装安装了 Java?如果是这样,那是你的问题!您需要到“手动”安装:http: //www.java.com/en/download/manual.jsp
It's just a matter of having the correct match of 32-bit Eclipse/32-bit Java or 64-bit Eclipse/64-bit Java. Many 64-bit Windows have 32-bit browsers and the latter is the version of Java that the auto-installer will provide - not what the 64-bit Eclipse wants.
这只是正确匹配 32 位 Eclipse/32 位 Java 或 64 位 Eclipse/64 位 Java 的问题。许多 64 位 Windows 具有 32 位浏览器,后者是自动安装程序将提供的 Java 版本 - 而不是 64 位 Eclipse 想要的。
回答by EldritchText
Newb move on my part, but I had installed just the JRE instead of JDK. Installed JDK and my problem went immediately away.
Newb 对我来说移动,但我只安装了 JRE 而不是 JDK。安装了 JDK,我的问题立即消失了。
回答by Liam15
Make sure the install path of JDK is in your Path variable in Windows.
确保 JDK 的安装路径在 Windows 的 Path 变量中。