简体   繁体   English

m2eclipse:Eclipse在JRE中运行,但需要JDK

[英]m2eclipse: Eclipse is running in a JRE, but a JDK is required

I have a problem with m2eclipse (0.10.0) together with eclipse galileo (Build id: 20090920-1017). m2eclipse(0.10.0)和eclipse galileo(Build id:20090920-1017)有问题。

I always get the error message:"Eclipse is running in a JRE, but a JDK is required". 我总是收到错误消息:“Eclipse正在JRE中运行,但需要JDK”。 I have tried several things, but nothing works. 我尝试了几件事,但没有任何作用。 The error message is still there. 错误消息仍然存在。 Here are the things I have tried: 以下是我尝试过的事情:

  • In Window>Preferences>Java>Installed JREs I checked JDK1.6.0_20. 在Window> Preferences> Java> Installed JREs中,我检查了JDK1.6.0_20。 DOES NOT WORK 什么都不行

  • In Window>Preferences>Java>Installed JREs I removed all JREs. 在Window> Preferences> Java> Installed JRE中,我删除了所有JRE。 Only the checked JDK1.6.0_20 is still there. 只有已检查的JDK1.6.0_20仍然存在。 DOES NOT WORK 什么都不行

  • In Window>Preferences>Java>Installed JREs>Execution Environments I choosed JavaSE-1.6 and checked JDK1.6.0_20[perfect match]. 在Window> Preferences> Java> Installed JREs> Execution Environments中我选择了JavaSE-1.6并检查了JDK1.6.0_20 [完全匹配]。 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). 在eclipse桌面启动图标的首选项中,我添加了-vm参数(C:\\ Program \\ eclipse_galileo \\ eclipse \\ eclipse.exe -vm C:\\ Program \\ 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). 我添加了clean参数(C:\\ Program \\ eclipse_galileo \\ eclipse \\ eclipse.exe -vm C:\\ Program \\ 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. 我将-vm参数添加到eclipse.ini文件中,并在-vm后添加回车符,并在新行中添加C:/Programme/Java/jdk1.6.0_20/bin/javaw.exe。 DOES NOT WORK. 什么都不行。

  • After doing all these things I removed the m2eclipse plugin and installed it once again. 完成所有这些操作后,我删除了m2eclipse插件并再次安装它。 DOES NOT WORK. 什么都不行。

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). 在eclipse桌面启动图标的首选项中,我将可执行文件放在最后(C:\\ Program \\ eclipse_galileo \\ eclipse \\ eclipse.exe -vm C:\\ Program \\ Java \\ jdk1.6.0_20 \\ bin \\ javaw.exe)。 DOES NOT WORK. 什么都不行。

  • I changed in eclipse.ini the slashes to backslashes. 我在eclipse.ini中将斜杠更改为反斜杠。 DOES NOT WORK. 什么都不行。

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 GernoK

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

MARIO-ORTEGON answered is the right answer to this problem. MARIO-ORTEGON回答是这个问题的正确答案。 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. 您唯一需要做的就是在eclipse.ini中的-product org.eclipse.epp.package.jee.product部分下移动“-vm C:\\ java \\ jdk \\ bin \\ javaw.exe”这一行。 like this: -product org.eclipse.epp.package.jee.product -vm C:\\java\\jdk\\bin\\javaw.exe save and restart the eclipse. 像这样:-product org.eclipse.epp.package.jee.product -vm C:\\ java \\ jdk \\ bin \\ javaw.exe保存并重新启动eclipse。 Error will be gone. 错误将消失。

I think these are answers needed when editing the eclipse.ini or STS.ini files: 我认为这些是编辑eclipse.iniSTS.ini文件时所需的答案:

A lot of people make these mistakes because they make certain assumptions (which is not correct): 很多人犯这些错误是因为他们做出了某些假设(这是不正确的):

  1. Mistake #1: Writing the parameters in the same line . 错误#1:在同一行中写入参数 Unlike JVM command line, Eclipse expects every parameters to be placed in different line in its eclipse.ini file. 与JVM命令行不同,Eclipse期望每个参数都放在eclipse.ini文件的不同行中。 One of the most common mistake is (which should be written in 2 separated lines): 最常见的错误之一是(应该用2个单独的行写成):

    -vm c:/Java/jdk1.6.0_31/bin/javaw.exe -vm c:/Java/jdk1.6.0_31/bin/javaw.exe

  2. Mistake #2: Writing the -vm and -vmargs in the wrong order . 错误#2:以错误的顺序编写-vm和-vmargs Sequence does matter. 顺序很重要。 The -vmargs has to be put before the -vm . -vmargs必须放在-vm之前。 Why? 为什么? Because once the -vm has been specified, the VM will be fully specified and the rest of the -vmargs will be ignored. 因为一旦指定了-vm ,就会完全指定VM,并忽略其余的-vmargs。

  3. Mistake #3: Assuming the eclipse.ini will stay the same if you don't change it . 错误#3:如果你不改变它,假设eclipse.ini将保持不变 Some plugins installation may have auto configuration (which after restarting automagically change the eclipse.ini file, or other .ini config file, eg STS.ini if you are using SpringSource Tool Suite for example), they will append indiscriminately the -vm before the -vmargs . 某些插件安装可能具有自动配置(在重新启动后自动更改eclipse.ini文件或其他.ini配置文件,例如STS.ini,如果您使用的是SpringSource Tool Suite),他们会在之前不加选择地附加-vm。 -vmargs Check for double occurrence of -vm or -vmargs . 检查-vm-vmargs的双重发生。

  4. Mistake #4: Pointing to the path of JVM, instead of the binary when specifying -vm . 错误#4:指定JVM的路径,而不是指定-vm时的二进制文件 Eclipse expects the Java JVM binary, not just the JAVA_HOME path eg -vm c:/Java/jdk1.6.0_31/bin/javaw.exe not just -vm c:/Java/jdk1.6.0_31 Eclipse期望Java JVM二进制文件,而不仅仅是JAVA_HOME路径,例如-vm c:/Java/jdk1.6.0_31/bin/javaw.exe,而不仅仅是-vm c:/Java/jdk1.6.0_31

For the original question, it seems the Mistake #2 is the cause. 对于原始问题,似乎错误#2是原因。 Instead of the one, you should move the -vm to the end, after -vmargs : -vmargs之后,你应该将-vm移到最后,而不是那个

-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
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
-vm
C:\Programme\Java\jdk1.6.0_20\bin\javaw.exe

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. 虽然我指的是它应该使用JDK,但Eclipse报告它在JRE(Win7 x64,32位JDK 1.6更新21)中运行时遇到了同样的问题。

I finally deleted JRE6 which 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

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. 关于ini文件,它取决于全部内容。 What does your ini file contains? 你的ini文件包含什么?

Put these lines at the beginning of the eclipse.ini file: 将这些行放在eclipse.ini文件的开头:

-vm
G:/dev/jdk1.6.0_19/bin/javaw.exe

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. 来自我的eclipse.ini文件。 Maybe you should use backslashes in that eclipse.ini. 也许你应该在那个eclipse.ini中使用反斜杠。

I too had this issue. 我也有这个问题。 This problem disappeared when I upgrade to Eclipse Indigo. 升级到Eclipse Indigo时,此问题消失了。 So try with Higher version. 所以尝试使用更高版本。

Check your Installed JRE setting of Eclipse. 检查Eclipse的Installed JRE设置。 It should point to JDK rather than JRE. 它应该指向JDK而不是JRE。 Though it is a JRE setup. 虽然这是一个JRE设置。 Remember JDK contains JRE and when Maven runs it tries to find out JDK mostly tools.jar. 记住JDK包含JRE,当Maven运行时,它试图找出JDK,主要是tools.jar。

There are two JVMs involved here; 这里涉及两个JVM; 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. 运行Eclipse的那个以及工作空间中不同项目运行的那个。我认为此消息指的是Eclipse正在运行的JVM。因此,解决方案不包含在“已安装的JRE中” “Eclipse中的部分。 It's the JVM that's in your path within Windows. 它是Windows中的JVM。

Java may be finding its files using the JAVA_HOME environment variable. Java可能正在使用JAVA_HOME环境变量查找其文件。 Try changing it to C:\\Programme\\Java\\jdk1.6.0_20 尝试将其更改为C:\\Programme\\Java\\jdk1.6.0_20

In Windows XP, this is under Control Panel, System, Advanced tab, Environment Variables button. 在Windows XP中,它位于“控制面板”,“系统”,“高级”选项卡,“环境变量”按钮下。

尝试添加此:

-vm E:\java\jdk1.6\jre\bin\client\jvm.dll

Uninstall the JRE leaving ONLY the JDK and private JRE behind. 卸载JRE,只留下JDK和私有JRE。 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). 运行Eclipse,它会立即抱怨它无法找到JRE或JDK(假设你的ini中缺少-vm选项或错误)。

Now put the -vm path to javaw in your ini file, save and Eclipse will now load the JDK. 现在将-vm路径放入ini文件中的javaw,保存,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和安装的数据库部分。

The uninstall method is the only thing that worked for me. 卸载方法是唯一对我有用的方法。 No amount of -vm magic made it happen until I only had the JDK installed. 在我只安装了JDK之前,没有任何-vm魔法可以实现。

I had the same problem but solved it. 我有同样的问题,但解决了它。 Add the -vm option as the first line in your eclipse.ini file and it will work. 添加-vm选项作为eclipse.ini文件中的第一行,它将起作用。

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

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