【问题标题】:After successful build at the comand line I get Eclipse error JVM terminated. Exit code=1在命令行成功构建后,我得到 Eclipse 错误 JVM 终止。退出代码=1
【发布时间】:2021-05-06 13:55:05
【问题描述】:

我正在为 C/C++ 开发人员使用 eclipse IDE(包括孵化组件) 版本:2021-03 (4.19.0) 版本号:20210312-0638

我在 lubuntu 20.10 64bit 上使用它。

我还安装了 java11 作为尝试解决问题的一部分: openjdk 11.0.11 2021-04-20 OpenJDK 运行环境(build 11.0.11+9-Ubuntu-0ubuntu2.20.10) OpenJDK 64-Bit Server VM(build 11.0.11+9-Ubuntu-0ubuntu2.20.10,混合模式,共享)

eclipse GUI 工作得很好,我可以编译我的代码。我有兴趣通过命令行编译 eclipse 项目(所以我可以将它作为 CI 管道的一部分运行)。

当我通过命令行编译它时,我的构建成功并且我得到了一个二进制文件。问题是我得到“JVM终止。退出代码=1”这使我的管道失败。

这是我用来编译的命令

./eclipse -nosplash --launcher.suppressErrors  -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import /<path_to_project>/ -data /<eclipse_work_space> -build <project_name>/Debug

这是编译完成后我收到的完整错误消息:

Eclipse:
JVM terminated. Exit code=1
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-jar /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
-os linux
-ws gtk
-arch x86_64
-launcher /home/drone/eclipse/cpp-2021-03/eclipse/eclipse
-name Eclipse
--launcher.library /home/drone/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.100.v20210209-1541/eclipse_11301.so
-startup /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
--launcher.appendVmargs
-exitdata 20
-product org.eclipse.epp.package.cpp.product
-application org.eclipse.cdt.managedbuilder.core.headlessbuild
-import /home/drone/azure_agent/_work/1/s/projects/RT-Linux/
-data /var/tmp/ee
-build linux_sim/Debug
-vm /usr/lib/jvm/java-11-openjdk-amd64/bin/java
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/
-jar /home/drone/eclipse/cpp-2021-03/eclipse//plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar 

这是 eclipse.ini 文件:

-startup
plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar
--launcher.library
/home/drone/.p2/pool/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.2.100.v20210209-1541
-product
org.eclipse.epp.package.cpp.product
-showsplash
/home/drone/.p2/pool/plugins/org.eclipse.epp.package.common_4.19.0.20210311-1200
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
/usr/lib/jvm/java-11-openjdk-amd64/bin/java
-vmargs
-Dosgi.requiredJavaVersion=11
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-Dsun.java.command=Eclipse
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=11
-Dosgi.dataAreaRequiresExplicitInit=true
-Dorg.eclipse.swt.graphics.Resource.reportNonDisposed=true
-Xms256m
-Xmx2048m
--add-modules=ALL-SYSTEM
-Declipse.p2.max.threads=10
-Doomph.update.url=http://download.eclipse.org/oomph/updates/milestone/latest
-Doomph.redirection.index.redirection=index:/->http://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/setups/

发帖前我搜索了一下,通过命令行编译的时候没有发现这个问题。

编辑: 如果它不会在构建过程中抑制编译错误,我会很好地抑制这个错误(所以我的管道不会因此而失败)。

【问题讨论】:

  • 如果你不--launcher.suppressErrors会有什么不同?
  • 不是真的,我只是得到同样的错误,但作为弹出窗口而不是作为命令行的一部分。

标签: java linux eclipse


【解决方案1】:

我已经解决了我的问题,所以为了后人我将解释我的具体问题,但主要是我努力提供一个更一般的解释,说明可能是什么原因导致“JVM 终止。当通过 CLI 在不注意模式下使用 eclipse 时,退出代码 = 1”。这是可能的原因之一(大多数处理此错误的线程将其归因于内存值不足,在 eclipse.ini 文件中设置)。

万恶之源是 eclipse 传达错误的方式。在最好的情况下,eclipse 将中止构建并明确说明发生了什么(感谢 eclipse 论坛的 David Vavra 提供的示例):

Project: file:<whatever> can't be found!
 Warning: Nashorn engine is planned to be removed from a future JDK release
 Saving workspace.
 Eclipse:
 JVM terminated. Exit code=1
Workspace already in use!
 Eclipse:
 JVM terminated. Exit code=1

在最坏的情况下,Eclipse 不仅没有说明出了什么问题,它还会说明一切都很好。在我的例子中,日食发送到标准输出:

Finished building target: linux_sim
 
15:20:20 Build Finished. 0 errors, 11 warnings. (took 9m:18s.202ms)

Eclipse:
JVM terminated. Exit code=1

所以在我的具体情况下,我有一个 Debug 构建和一个 Release 构建作为我的 eclipse 项目的一部分。我使用工具链进行交叉编译,并且我的所有构建都使用 Debug 设置编译,而 Release 则无人维护。很长一段时间,我已经从工具链 X 移动到 Y,但没有更新发布设置的“路径”和“前缀”,并从我的机器上删除了已弃用的工具链。当我使用 GUI 时,这项工作就很好。

一旦我在不注意的模式下使用 eclipse,我明确表示我只想通过声明 -build /Debug 来使用调试设置进行编译,而 eclipse 确实只编译了调试设置。

从命令行:

15:11:02 **** Build of configuration Debug for project linux_sim ****

没有提到:

**** Build of configuration Release for project linux_sim **** 

在我构建期间的任何地方用于项目 linux_sim。

虽然我明确表示我只想编译 Debug 配置,尽管 eclipse 符合我的要求,但它确实尝试加载 Release 的设置,当一直滚动到构建过程的开始时,我注意到这两行:

Unable to find full path for "arm-poky-linux-gnueabi-gcc"
Unable to find full path for "arm-poky-linux-gnueabi-g++"

一旦我从不推荐使用的工具链的“前缀”和“路径”中清除了发布配置 “JVM 终止。退出代码=1”* 问题已解决。

这个问题的真正优点(除了不应该加载的 eclipse 加载设置)是虽然 "Unable to find full path for "arm-poky-linux-gnueabi-gcc"" 合格作为向标准输出发送 “JVM 终止的原因。 Exit code=1” 消息 eclipse 没有中止构建过程,并允许它以“成功”消息完成,然后才发送“JVM 终止。退出代码=1”消息发送到标准输出,但没有提供任何原因。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多