Java / Eclipse 问题:无法使受保护的 void java.net.URLClassLoader.addURL(java.net.URL) 可访问:模块 java.base 不

Java / Eclipse 问题:无法使受保护的 void java.net.URLClassLoader.addURL(java.net.URL) 可访问:模块 java.base 不

今天我尝试在 Ubuntu 16.04 上启动 Eclipse,出现以下错误:

/opt/eclipse-neon-manual/eclipse
java.lang.ExceptionInInitializerError
    at org.eclipse.osgi.storage.Storage.<init>(Storage.java:100)
    at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:87)
    at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:66)
    at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:303)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:239)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:538)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @67e2d983
    at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
    at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:192)
    at java.base/java.lang.reflect.Method.setAccessible(Method.java:186)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:51)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findMethod(FrameworkExtensionInstaller.java:58)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.findAddURLMethod(FrameworkExtensionInstaller.java:42)
    at org.eclipse.osgi.storage.FrameworkExtensionInstaller.<clinit>(FrameworkExtensionInstaller.java:36)
    ... 14 more
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

如何解决这个问题?

答案1

我有一个 Ubuntu 64 位系统。

当我尝试在系统上安装已安装 Java 9 的 Eclipse 时出现了该错误消息。

我从 Java 9 切换到 Java 8,Eclipse Neon 安装得很好。

切换 Java 版本的方法如下=https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

答案2

下载最新的 Eclipse 来修复该问题。

就我而言,我下载了 Eclipse Neon 2。

此后,日食再次正常开始。

相关内容