【问题标题】:Eclipse won't open in Linux Mint and Java won't open in different directoriesEclipse 不会在 Linux Mint 中打开,Java 不会在不同的目录中打开
【发布时间】:2017-10-18 09:56:13
【问题描述】:

我在 Linux Mint 18.2 cinnamon 中使用 openjdk-9 安装了 /opt/eclipse 中的 Eclipse(请不要告诉我切换 oracle jdk)。每当我单击 Eclipse 图标时,都会显示此窗口:

这是那个窗口的内容:

JVM terminated. Exit code=1
/usr/bin/java
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
-os linux
-ws gtk
-arch x86_64
-showsplash /opt/eclipse//plugins/org.eclipse.epp.package.common_4.7.1.20171005-1200/splash.bmp
-launcher /opt/eclipse/eclipse
-name Eclipse
--launcher.library /opt/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.550.v20170928-1359/eclipse_1629.so
-startup /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.appendVmargs
-exitdata 828016
-product org.eclipse.epp.package.java.product
-vm /usr/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
--add-modules=ALL-SYSTEM
-Dosgi.requiredJavaVersion=1.8
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM
-jar /opt/eclipse//plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar 

这是我的 Java:

$java -version
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)

当我在/opt/eclipse 中输入相同的命令时,我得到了这个:

/opt/eclipse $ java -version
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
    at java.lang.System.initProperties(java.base/Native Method)
    at java.lang.System.initPhase1(java.base/System.java:1850)

当我尝试从终端打开它时,我得到了这个:-

$ eclipse 
Unrecognized option: --add-modules=ALL-SYSTEM
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

【问题讨论】:

  • 我想如果java -version 可以工作,Eclipse 也可以工作。 /opt/eclipse 目录是否存在,它是一个真实的目录(不仅仅是一个链接)吗? stackoverflow.com/q/11038056/6505250
  • @howlger 谢谢先生,/opt/eclipse 是真实的。我在底部添加了一些信息。请看一下。
  • Java 9 建议使用Eclipse 氧气。您似乎有霓虹灯。不确定那个星座。
  • @JoopEggen 这是氧气
  • 删除文件eclipse.ini中的--add-modules=ALL-SYSTEM行,然后重试。

标签: java linux eclipse openjdk


【解决方案1】:

文件eclipse.ini删除--add-modules=ALL-SYSTEM这一行。

在 Java 9 中引入了 Java Platform Module System,它封装了大多数内部 API。 --add-modules=ALL-SYSTEM 是一个 Java 9 虚拟机 (VM) 参数,使其行为类似于 Java 9 之前的行为。

JEP 261: Module System

作为运行时的另一个特殊情况,如果是ALL-SYSTEM 那么 所有系统模块都添加到根集中,无论它们是否 在默认设置中。这有时是测试工具所需要的。这个 选项将导致许多模块被解析;一般来说,ALL-DEFAULT 应该是首选。

【讨论】:

  • 在 JDK 8 的 Eclipse Oxygen 中启动“Eclipse 应用程序”(例如,用于插件开发)时出现类似问题。出于某种原因,在“项目属性”>“运行/调试设置”中>“Eclipse 应用程序”>“参数”>“VM 参数”包含--add-modules=ALL-SYSTEM。在那里删除它。
猜你喜欢
  • 1970-01-01
  • 2016-02-06
  • 2011-09-28
  • 2017-06-17
  • 1970-01-01
  • 2011-02-16
  • 1970-01-01
  • 2023-03-21
  • 2023-03-27
相关资源
最近更新 更多