Eclipse 返回错误消息“Java 已启动但返回退出代码 = 1”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18609160/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 09:29:18  来源:igfitidea点击:

Eclipse returns error message "Java was started but returned exit code = 1"

javaeclipseerror-handling

提问by Vladislav Bogdanov

this is a picture of the error code

这是错误代码的图片

I just downloaded and dearchived android SDK for Windows. I`m currently using W8 64x.

我刚刚下载并清除了适用于 Windows 的 android SDK。我目前正在使用 W8 64x。

采纳答案by Calon

The error message points to a problem with your Java version. Do you have a JDK installed?

该错误消息指出您的 Java 版本存在问题。你安装了JDK吗?

Try adding the following (noting the new line):

尝试添加以下内容(注意新行):

/!\ make sure, that the -vmoption occurs beforethe -vmargscommand. Everything after -vmargsis passed directly to the JVM.

/!\确认,该-vm选项出现之前-vmargs命令。之后的所有内容都-vmargs直接传递给 JVM。

-vm 
c:/wherever/java/jdk1.6.0_21/jre/bin/server/jvm.dll
-vmargs... 

...to your eclipse.inifile, pointing to the JDK you want to use, and check that the required Java version is at least as new as your JDK. This is the path for a Windows system. More on paths can be found here(scroll down).

...指向您的eclipse.ini文件,指向您要使用的 JDK,并检查所需的 Java 版本是否至少与您的 JDK 一样新。这是Windows系统的路径。可以在此处找到有关路径的更多信息(向下滚动)。

If you don't know where the eclipse.inifile is: regularly it is in the folder of your eclipse.exe.

如果您不知道eclipse.ini文件在哪里:通常它位于您的eclipse.exe.

Edit2:@KadoLakatt: the reason why installing the latest Java Version worked for you is because Eclipse checks the standard path for a JVM if it doesn't find a -vmentry (see here). However I'd not recommend that, since you might be wrong guessing the JVM used. If you update Java (automatically?) you might run into problems in your Eclipse wondering what you might have changed. Better set it to a specific folder in your eclipse.inito be certain.

Edit2:@KadoLakatt:安装最新的 Java 版本对您有用的原因是因为 Eclipse 会在未找到-vm条目时检查 JVM 的标准路径(请参阅此处)。但是我不建议这样做,因为您可能猜错了所使用的 JVM。如果您更新 Java(自动?),您可能会在 Eclipse 中遇到问题,想知道您可能更改了什么。最好将其设置到您的特定文件夹中eclipse.ini以确保。

回答by Bernie

I've encountered similar problems. The reason is that the path to my eclipse includes Chinese characters. Once those characters are deleted, the problem is solved. Please check if there are characters other than English in your path.

我遇到过类似的问题。原因是我的eclipse路径包含汉字。一旦删除这些字符,问题就解决了。请检查您的路径中是否有英文以外的字符。

回答by Vivek

This can be resolved by adding the following line to the eclipse.ini file -XX:-UseCompressedOops

这可以通过将以下行添加到 eclipse.ini 文件 -XX:-UseCompressedOops 来解决

回答by Abu Shumon

it can be like this as well:

它也可以是这样的:

-vm 
C:\Program Files\Java\jre6\bin\server\jvm.dll

回答by paul

just to add here...
For the guys those who still couldn't start eclipse due same error, please check eclipse.ini file again and see have you forgot to put Mafter memory size. For example:

只是在这里补充...
对于那些由于同样的错误仍然无法启动eclipse的人,请再次检查eclipse.ini文件,看看你是否忘记把M内存大小放在后面。例如:

-Xmx1024
or
-Xmx1024MB
or
-Xmx1024 M
or
-Xmx1024 mb
or
-Xmx1024mb

are incorrect, it should be -Xmx1024M. I have been trying different ideas from SOF and from other forums, and in this cut/paste I forgot that I missed M(such a little thing to miss), so I thought I should share. If it works for some of you please up-vote.

不正确,应该是-Xmx1024M。我一直在尝试来自 SOF 和其他论坛的不同想法,在这个剪切/粘贴中我忘记了我错过了M(这么小的事情要错过),所以我想我应该分享。如果它对你们中的一些人有用,请投票。

回答by user3337536

if it says c:/program files/java/jre/bin/server/jvm.dll not found then copy the jre from jdk folder and paste it outside the jdk folder . and then try again...

如果它说 c:/program files/java/jre/bin/server/jvm.dll not found 然后从 jdk 文件夹复制 jre 并将其粘贴到 jdk 文件夹之外。然后再试一次...

回答by blue-sky

I received this error out of the blue. Eclipse stopped working even though I made no config changes and did not install any new jdk's.

我突然收到了这个错误。即使我没有更改配置并且没有安装任何新的 jdk,Eclipse 也停止工作。

Here was my eclipse.ini file :

这是我的 eclipse.ini 文件:

--clean
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:/Program Files (x86)/Java/jre7/bin/javaw.exe
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.6
-Xms40m
-Xmx1024m

To get Eclipse to start successfully I removed

为了让 Eclipse 成功启动,我删除了

    -vmargs
    -Dosgi.requiredJavaVersion=1.6
    -vm 
C:/Program Files (x86)/Java/jre7/bin/javaw.exe

So here is my updated file :

所以这是我更新的文件:

--clean
-startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20130327-1440.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.200.v20130807-1835
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-Xms40m
-Xmx1024m

I have no idea why removing osgi.requiredJavaVersion=1.6 fixed this as my jvm version is 1.6. From the doc http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

我不知道为什么删除 osgi.requiredJavaVersion=1.6 解决了这个问题,因为我的 jvm 版本是 1.6。来自文档http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fmisc%2Fruntime-options.html

osgi.requiredJavaVersion
The minimum java version that is required to launch Eclipse. The default value is "1.4.1".

I think my java version was set correctly. Anyway Eclipse starts and runs for me now......

我认为我的 java 版本设置正确。无论如何 Eclipse 现在为我启动并运行......

回答by user_CC

I had this issue recently, but I hadn't changed any java or updated the java version, May be this issue happened because of crash shutdown of the system.

我最近遇到了这个问题,但我没有更改任何java或更新java版本,可能是由于系统崩溃关闭而导致的这个问题。

And after reading a couple of answers here I decided to change the java version from 1.6 to 1.7 in the eclipse.ini file.

在这里阅读了几个答案后,我决定将 eclipse.ini 文件中的 java 版本从 1.6 更改为 1.7。

-vmargs
-Dosgi.requiredJavaVersion=1.6  

After this change the Eclipse started well and it worked. Since I didnt had changed anything i decided to change it back to 1.6 to what it was originally.

在此更改之后,Eclipse 启动良好并且工作正常。由于我没有改变任何东西,我决定将它改回 1.6 到原来的样子。

Then I started eclipse and guess what it worked. So Looks like in my case just touching/modifiying the eclipse.ini file worked.

然后我开始 eclipse 并猜测它的工作原理。所以看起来在我的情况下只是触摸/修改 eclipse.ini 文件工作。

I hope this answer is helpful to somebody.

我希望这个答案对某人有帮助。

回答by Lalit Narayan Mishra

Adding -vmparameters works for me.

添加-vm参数对我有用。

-vm 
C:\Program Files\Java\jdk1.7.0_45\jre\bin\server\jvm.dll

回答by CRM

I had same issue in my windows 7, 64-bit machine. Then I downloaded and installed 64 bit jdk for Java(which includes jre). This solved the issue.

我在 Windows 7 64 位机器上遇到了同样的问题。然后我下载并安装了 Java 的 64 位 jdk(包括 jre)。这解决了这个问题。