Java 已启动但返回退出代码=1

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

Java was started but returned with exit code=1

javaeclipsemuleclasspathanypoint-studio

提问by Simbu

I am receiving error called - Java was started but returned with exit code=1

我收到错误,称为 - Java was started but returned with exit code=1

Updated Error image after installing JDK

安装 JDK 后更新错误图像

I have received this error after upgrading my java. I can see my ini file has below content.

升级我的java后我收到了这个错误。我可以看到我的 ini 文件有以下内容。

 -startup
plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.200.v20150204-1316
-vm C:\Program Files (x86)\Java\jdk1.8.0_73\jre\bin\server\jvm.dll
-vmargs
-Dfile.encoding=UTF-8
-Xms512m
-Xmx1536m
-XX:MaxPermSize=512m
[email protected]/AnypointStudio/workspace

JAVA_HOME has value as C:\Program Files (x86)\Java\jdk1.8.0_73Path env has value as C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Java\jre1.8.0_73\bin;C:\Program Files (x86)\Java\jdk1.8.0_73\bin;

JAVA_HOME 的价值为C:\Program Files (x86)\Java\jdk1.8.0_73Path env 的价值为C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Java\jre1.8.0_73\bin;C:\Program Files (x86)\Java\jdk1.8.0_73\bin;

My new updated jre is in below location. C:\Program Files (x86)\Java\jre1.8.0_73\bin

我新更新的 jre 位于以下位置。 C:\Program Files (x86)\Java\jre1.8.0_73\bin

Note that i found many solutions for this issue in this site which are not working for me. Kindly guide me where i am doing wrong.

请注意,我在此站点中找到了许多对我不起作用的解决方案。请指导我哪里做错了。

采纳答案by Simbu

Earlier i have used 64 bit java. Later i have used (x86) java it caused issue. After updating with 64 bit java the issue got resolved.

早些时候我使用过 64 位 java。后来我使用了(x86)java,它导致了问题。使用 64 位 java 更新后,问题得到解决。

回答by Ahmed Hashim

You need only JRE to be able to run Eclipse but of course to be able to compile Java code you need JDK.

您只需要 JRE 就可以运行 Eclipse,但当然要能够编译 Java 代码,您需要 JDK。

It is recommended to use JDK for Java_Home, in case you will continue using the JRE you must set set the JAVA_HOME to "C:\Program Files (x86)\Java\jre1.8.0_73".

建议使用 JDK for Java_Home,如果您将继续使用 JRE,您必须将 JAVA_HOME 设置为“C:\Program Files (x86)\Java\jre1.8.0_73”。

One of the tricks to copy JRE1.8.0_73 directory to eclipse directory and rename it to jre. This will be used by eclipse default even if there is multiple JRE installed on your environment.

将JRE1.8.0_73目录复制到eclipse目录并重命名为jre的技巧之一。即使您的环境中安装了多个 JRE,eclipse 默认也会使用它。

Last point, make sure that you restore memory setting in config.ini (xms, xmx, MaxPermSize) to default values. MaxPermSize will be ignored by Java8 JVMbut you can keep it.

最后一点,请确保将 config.ini (xms, xmx, MaxPermSize) 中的内存设置恢复为默认值。MaxPermSize 将被Java8 JVM忽略,但您可以保留它。

回答by aprodan

I had same issue today with Eclipse Neon.2 after java jre was updated in Chrome Browser from 1.8.0_111 to 1.8.0.131. It looks to me it removed 64 bits version of 1.8.0_111 and installed only 32 bits version of jre 1.8.0.131.

在 Chrome 浏览器中将 java jre 从 1.8.0_111 更新到 1.8.0.131 之后,我今天在 Eclipse Neon.2 上遇到了同样的问题。在我看来,它删除了 1.8.0_111 的 64 位版本并仅安装了 jre 1.8.0.131 的 32 位版本。

To fix this issue I had to update JDK from 1.8.0_111(64) -> 1.8.0.131(64). This installed as well jre on 64 bits and Eclipse Neon.2 started successfully this time.

为了解决这个问题,我必须从 1.8.0_111(64) -> 1.8.0.131(64) 更新 JDK。这在 64 位上也安装了 jre,这次 Eclipse Neon.2 成功启动。

回答by user1708042

In my case the error was pretty silly: in the config.ini there was an error in the last line where the memory parameter -Xmx was set to "2024". I'm pretty sure I did not edit that line by hand. I reverted it to -Xmx1024m to make it work

在我的情况下,错误非常愚蠢:在 config.ini 中,内存参数 -Xmx 设置为“2024”的最后一行出现错误。我很确定我没有手动编辑该行。我将其恢复为 -Xmx1024m 以使其正常工作

-Xmx2024m

changed to

变成

-Xmx1024m

the issue seems to be related to the Java vm 1.8.131 (32bit) that responds with an error any time I try to ask more than 1477m, even when I have more than 4GB of free ram:

该问题似乎与 Java vm 1.8.131(32 位)有关,每当我尝试询问超过 1477m 时都会响应错误,即使我有超过 4GB 的可用内存:

java -Xmx1477m
Error occurred during initialization of VM
Could not reserve enough space for 1513472KB object heap

on the same PC a JDK 1.7 does not have any issues in using 2GB

在同一台 PC 上,JDK 1.7 在使用 2GB 时没有任何问题

回答by user8657661

I installed java 9 JDK 64 bit. The install took care of everything in my case and allowed me to start the Anypoint studio from my existing short cut. In some cases you may need to still manually edit your settings but try just a 64 bit install first

我安装了 java 9 JDK 64 位。安装处理了我的所有问题,并允许我从现有的快捷方式启动 Anypoint 工作室。在某些情况下,您可能仍需要手动编辑设置,但先尝试安装 64 位

回答by NabRaj_Baitadi

I had exactly similar error. Eclipse worked well after I deleted 'javapath' folder from C:\ProgramData\Oracle\Java directory.

我有完全类似的错误。从 C:\ProgramData\Oracle\Java 目录中删除“javapath”文件夹后,Eclipse 运行良好。

回答by sudhakkar k

Change the path in the .ini-file.

更改 .ini 文件中的路径。

-vm
C:\Program Files\Java\JDK1.8.0_172\bin\javaw.exe 

if you still see the issue Change it into:

如果您仍然看到问题,请将其更改为:

-vm
C:\Program Files\Java\jdk1.8.0_172\jre\bin\server\jvm.dll

Note: The path should be in the new line after -vm.

注意:路径应该在 -vm 之后的新行中。