Eclipse出现java was started but returned exit code 1报错并退出

Eclipse出现java was started but returned exit code 1报错并退出

最近在使用Eclipse时发现无法启动或者启动后经常出现崩溃退出的情况,提示的错误信息都是“java was started but returned exit code 1”,下载安装了最新版的Eclipse后还是没有解决问题。无奈之下只好百度之,翻了好几页都没有发现有用的信息,直接换到Google.com,终于在Eclipse Forum找到了一个靠谱的答案(网址是http://www.eclipse.org/forums/index.php?t=tree&goto=547573&#page_top),回答答案是“Eclipse is using the system default JRE that it finds in the windows system folders. You should point it to a JDK installation using eclipse.ini (as described here: http://wiki.eclipse.org/Eclipse.ini )”,大意是Eclipse启动的时候默认会使用从windows系统目录下找到的JRE作为默认的环境,由于我之前升级安装了一下JDK,所以系统目录下的JRE和实际的Java安装是不匹配的,因此会出现运行Eclipse时报错的情况。
解决方案:
根据eclipse.ini文件的说明(http://wiki.eclipse.org/Eclipse.ini),该文件提供指定运行eclipse的JVM功能,需要在eclipse.ini中加入JVM的路径说明。语法很简单:

-vm
C:\Program Files\Java\jdk1.6.0_22\bin\javaw.exe

eclipse.ini说明文档中特别提到使用-vm参数的注意事项:
(1)The -vm option and its value (the path) must be on separate lines.(-vm选项和其对应的javaw.exe的路径必须各占一行,这应该是参数解析的格式要求)
(2)The value must be the full absolute path to the Java executable, not just to the Java home directory.(指定的虚拟机路径必须是指向可执行Java程序的完整绝对路径,不能只指定到Java_HOME目录。这个好理解,要指定JVM的话肯定要指定到具体的可执行文件去)
(3)The -vm option must occur before the -vmargs option, since everything after -vmargs is passed directly to the JVM.(-vm选项必须放在-vmargs选项前,这是因为-vmargs选项后的值都是作为JVM的参数传给虚拟机的,如果-vm放在-vmargs之后就没有意义了。而-vmargs选项中一般可指定-Xms和-Xmx这两个内存参数)

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值