Java m2eclipse:Eclipse 在 JRE 中运行,但需要 JDK
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2921473/
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
m2eclipse: Eclipse is running in a JRE, but a JDK is required
提问by GernoK
I have a problem with m2eclipse (0.10.0) together with eclipse galileo (Build id: 20090920-1017).
我对 m2eclipse (0.10.0) 和 eclipse galileo(构建 ID:20090920-1017)有问题。
I always get the error message:"Eclipse is running in a JRE, but a JDK is required". I have tried several things, but nothing works. The error message is still there. Here are the things I have tried:
我总是收到错误消息:“Eclipse 正在 JRE 中运行,但需要 JDK”。我尝试了几件事,但没有任何效果。错误信息仍然存在。以下是我尝试过的事情:
In Window>Preferences>Java>Installed JREs I checked JDK1.6.0_20. DOES NOT WORK
In Window>Preferences>Java>Installed JREs I removed all JREs. Only the checked JDK1.6.0_20 is still there. DOES NOT WORK
In Window>Preferences>Java>Installed JREs>Execution Environments I choosed JavaSE-1.6 and checked JDK1.6.0_20[perfect match]. DOES NOT WORK.
In Preferences of the eclipse desktop start icon I added the -vm parameter (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin). DOES NOT WORK.
I added the clean parameter (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin -clean). DOES NOT WORK.
I added the -vm parameter to the eclipse.ini file with a carriage return after -vm and C:/Programme/Java/jdk1.6.0_20/bin/javaw.exe in a new line. DOES NOT WORK.
After doing all these things I removed the m2eclipse plugin and installed it once again. DOES NOT WORK.
在 Window>Preferences>Java>Installed JREs 我检查了 JDK1.6.0_20。不工作
在 Window>Preferences>Java>Installed JREs 中,我删除了所有 JRE。只有勾选的JDK1.6.0_20还在。不工作
在 Window>Preferences>Java>Installed JREs>Execution Environments 我选择了 JavaSE-1.6 并检查了 JDK1.6.0_20[perfect match]。不工作。
在 eclipse 桌面启动图标的首选项中,我添加了 -vm 参数(C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin)。不工作。
我添加了干净参数(C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin -clean)。不工作。
我将 -vm 参数添加到 eclipse.ini 文件中,并在新行中的 -vm 和 C:/Programme/Java/jdk1.6.0_20/bin/javaw.exe 之后回车。不工作。
完成所有这些事情后,我删除了 m2eclipse 插件并再次安装了它。不工作。
New ideas I have tried:
我尝试过的新想法:
In Preferences of the eclipse desktop start icon I put the executable at the end (C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin\javaw.exe). DOES NOT WORK.
I changed in eclipse.ini the slashes to backslashes. DOES NOT WORK.
在 eclipse 桌面启动图标的首选项中,我将可执行文件放在最后(C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin\javaw.exe)。不工作。
我在 eclipse.ini 中将斜杠更改为反斜杠。不工作。
Here is my eclipse.ini file:
这是我的 eclipse.ini 文件:
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
-vm
C:\Programme\Java\jdk1.6.0_20\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
Is anyone out there who have other ideas? Any help is appreciated.
有没有人有其他想法?任何帮助表示赞赏。
Thank You very much. GernoK
非常感谢您。格诺克
回答by Mario Ortegón
I think you have to explicity add the executable to the -vm argument:
我认为您必须明确地将可执行文件添加到 -vm 参数中:
C:\Programme\eclipse_galileo\eclipse\eclipse.exe -vm C:\Programme\Java\jdk1.6.0_20\bin\javaw
Regarding the ini file, it depends on the full contents. What does your ini file contains?
关于ini文件,它取决于完整的内容。你的ini文件包含什么?
回答by xor_eq
I'm getting the same error message as soon as I remove these two lines
删除这两行后,我会立即收到相同的错误消息
-vm
C:\Programme\Java\jdk1.6.0_10\bin\javaw.exe
from my eclipse.ini file. Maybe you should use backslashes in that eclipse.ini.
来自我的 eclipse.ini 文件。也许您应该在 eclipse.ini 中使用反斜杠。
回答by Rob Heiser
There are two JVMs involved here; the one that Eclipse is running in and the one (or more) that the different projects in your workspace run in. I think this message refers to the JVM that Eclipse is running in. So, the solution is not contained in the "Installed JREs" section within Eclipse. It's the JVM that's in your path within Windows.
这里涉及两个 JVM;Eclipse 正在运行的那个和工作区中不同项目运行的一个(或多个)。我认为此消息指的是 Eclipse 正在运行的 JVM。因此,该解决方案不包含在“已安装的 JRE”中" Eclipse 中的部分。这是您在 Windows 中的路径中的 JVM。
回答by Powerlord
Java may be finding its files using the JAVA_HOME
environment variable. Try changing it to C:\Programme\Java\jdk1.6.0_20
Java 可能正在使用JAVA_HOME
环境变量查找其文件。尝试将其更改为C:\Programme\Java\jdk1.6.0_20
In Windows XP, this is under Control Panel, System, Advanced tab, Environment Variables button.
在 Windows XP 中,它位于控制面板、系统、高级选项卡、环境变量按钮下。
回答by Crutis
I had the same problem with Eclipse reporting that it was running in the JRE (Win7 x64, 32 Bit JDK 1.6 update 21), even though I was specifying that it should use the JDK.
我遇到了同样的问题,Eclipse 报告它在 JRE(Win7 x64,32 位 JDK 1.6 更新 21)中运行,即使我指定它应该使用 JDK。
I finally deleted JRE6which is optionally installable with the JDK and the message disappeared.
我最终删除了 JRE6,它可以与 JDK 一起安装,并且消息消失了。
Someone with a deeper understanding of Windows will have to explain why it does this, but it is apparently ignoring the eclipse.ini setting, as well as JAVA_HOME and starting eclipse in the JRE anyway.
对 Windows 有更深入了解的人必须解释它为什么这样做,但它显然忽略了 eclipse.ini 设置,以及 JAVA_HOME 并无论如何在 JRE 中启动 eclipse。
My eclipse.ini:
我的eclipse.ini:
-vm
C:/Java/jdk1.6.0_21/bin/javaw.exe
-startup
plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.0.200.v20090519
-product
org.eclipse.epp.package.jee.product
-nosplash
org.eclipse.platform
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms32m
-Xmx1024m
-Xss6m
-XX:PermSize=32m
-XX:MaxPermSize=256m
-XX:CompileThreshold=5
-XX:MaxGCPauseMillis=10
-XX:MaxHeapFreeRatio=70
-XX:+UseParallelGC
-XX:+AggressiveOpts
-Dcom.sun.management.jmxremote
JAVA_HOME
JAVA_HOME
C:\Windows\system32>echo %JAVA_HOME%
C:\Java\jdk1.6.0_21
回答by venkatb
Try adding this:
尝试添加这个:
-vm E:\java\jdk1.6\jre\bin\client\jvm.dll
回答by Jeremy Goodell
Unbelievable, the solution to this problem has nothing to do with slashes, backslashes, quotes, spaces, jre, jdk, jvm, javaw, ....
难以置信,这个问题的解决方法与斜杠、反斜杠、引号、空格、jre、jdk、jvm、javaw、....
The answer is that you have to have a line break between
答案是你之间必须有一个换行符
-vm
-vm
and the path.
和路径。
So in the eclipse.ini file:
所以在 eclipse.ini 文件中:
THIS WILL NOT WORK:
这行不通:
-vm C:\java\jdk\bin\javaw.exe
BUT THIS WILL:
但这将:
-vm
C:\java\jdk\bin\javaw.exe
回答by Barry
Uninstall the JRE leaving ONLY the JDK and private JRE behind. Run Eclipse, and it will immediately complain that it can't find a JRE or JDK (assuming the -vm option is missing or wrong in your ini).
卸载 JRE,只留下 JDK 和私有 JRE。运行 Eclipse,它会立即抱怨找不到 JRE 或 JDK(假设 -vm 选项在您的 ini 中丢失或错误)。
Now put the -vm path to javaw in your ini file, save and Eclipse will now load the JDK.
现在将 javaw 的 -vm 路径放入您的 ini 文件中,保存,Eclipse 现在将加载 JDK。
I actually went ahead and uninstalled everything Java and then reinstalled JDK 6 leaving out the public JRE and the database portion of the install.
我实际上继续卸载了所有 Java,然后重新安装了 JDK 6,省略了公共 JRE 和安装的数据库部分。
回答by Eduardo
Put these lines at the beginning of the eclipse.ini
file:
将这些行放在eclipse.ini
文件的开头:
-vm
G:/dev/jdk1.6.0_19/bin/javaw.exe
回答by Ran Azad
MARIO-ORTEGON answered is the right answer to this problem. The only thing you need to do is to move this line "-vm C:\java\jdk\bin\javaw.exe" under the section -product org.eclipse.epp.package.jee.product in eclipse.ini. like this: -product org.eclipse.epp.package.jee.product -vm C:\java\jdk\bin\javaw.exe save and restart the eclipse. Error will be gone.
MARIO-ORTEGON 回答是这个问题的正确答案。您唯一需要做的就是将这一行“-vm C:\java\jdk\bin\javaw.exe”移到 eclipse.ini 中的 -product org.eclipse.epp.package.jee.product 部分下。像这样: -product org.eclipse.epp.package.jee.product -vm C:\java\jdk\bin\javaw.exe 保存并重新启动eclipse。错误将消失。