Ubuntu 17.04 上的 Netbeans 8.1

Ubuntu 17.04 上的 Netbeans 8.1

我尝试通过单击此处的 apt 链接来安装 Netbeans:https://doc.ubuntu-fr.org/netbeans

安装的包是“netbeans”

因此:sudo apt install netbeans

该程序运行启动画面几秒钟然后崩溃。

有小费吗?

t@tsu:~/src/edk2$ netbeans 
Jun 08, 2017 8:57:06 PM org.netbeans.ProxyURLStreamHandlerFactory register
SEVERE: No way to find original stream handler for jar protocol
java.lang.reflect.InaccessibleObjectException: Unable to make field transient java.net.URLStreamHandler java.net.URL.handler accessible: module java.base does not "opens java.net" to unnamed module @6d8a00e3
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:175)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:169)
    at org.netbeans.ProxyURLStreamHandlerFactory.register(Unknown Source)
    at org.netbeans.JarClassLoader.<clinit>(Unknown Source)
    at org.netbeans.MainImpl.execute(Unknown Source)
    at org.netbeans.MainImpl.main(Unknown Source)
    at org.netbeans.Main.main(Unknown Source)

Jun 08, 2017 8:57:06 PM org.openide.util.lookup.implspi.ActiveQueue reportError
WARNING: Cannot hack ReferenceQueue to fix bug #206621!
java.lang.reflect.InaccessibleObjectException: Unable to make field private java.lang.ref.ReferenceQueue$Lock java.lang.ref.ReferenceQueue.lock accessible: module java.base does not "opens java.lang.ref" to unnamed module @6d8a00e3
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:337)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:281)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:175)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:169)
    at org.openide.util.lookup.implspi.ActiveQueue$Impl.<clinit>(Unknown Source)
    at org.openide.util.lookup.implspi.ActiveQueue.queue(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.activeQueue(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.access$600(Unknown Source)
    at org.openide.util.lookup.AbstractLookup$ReferenceToResult.<init>(Unknown Source)
    at org.openide.util.lookup.AbstractLookup$ReferenceToResult.<init>(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.lookup(Unknown Source)
    at org.openide.util.Lookup.lookupResult(Unknown Source)
    at org.openide.util.Lookup.lookupAll(Unknown Source)
    at org.netbeans.MainImpl$BootClassLoader.allCLIs(Unknown Source)
    at org.netbeans.CLIHandler.initialize(Unknown Source)
    at org.netbeans.MainImpl.execute(Unknown Source)
    at org.netbeans.MainImpl.main(Unknown Source)
    at org.netbeans.Main.main(Unknown Source)

Jun 08, 2017 8:57:06 PM org.openide.util.lookup.implspi.ActiveQueue reportError
WARNING: Cannot hack ReferenceQueue to fix bug #206621!
java.lang.IllegalAccessException: class org.openide.util.lookup.implspi.ActiveQueue$Impl cannot access a member of class java.lang.ref.ReferenceQueue (in module java.base) with modifiers "private"
    at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:361)
    at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:589)
    at java.base/java.lang.reflect.Field.checkAccess(Field.java:1074)
    at java.base/java.lang.reflect.Field.get(Field.java:415)
    at org.openide.util.lookup.implspi.ActiveQueue$Impl.<init>(Unknown Source)
    at org.openide.util.lookup.implspi.ActiveQueue.queue(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.activeQueue(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.access$600(Unknown Source)
    at org.openide.util.lookup.AbstractLookup$ReferenceToResult.<init>(Unknown Source)
    at org.openide.util.lookup.AbstractLookup$ReferenceToResult.<init>(Unknown Source)
    at org.openide.util.lookup.AbstractLookup.lookup(Unknown Source)
    at org.openide.util.Lookup.lookupResult(Unknown Source)
    at org.openide.util.Lookup.lookupAll(Unknown Source)
    at org.netbeans.MainImpl$BootClassLoader.allCLIs(Unknown Source)
    at org.netbeans.CLIHandler.initialize(Unknown Source)
    at org.netbeans.MainImpl.execute(Unknown Source)
    at org.netbeans.MainImpl.main(Unknown Source)
    at org.netbeans.Main.main(Unknown Source)

t@tsu:~/src/edk2$ 

答案1

您安装 NetBeans 8.1 时遵循的教程已过时。当前版本的 NetBeans 需要 openjdk-8-jdk,而不是教程中推荐的 openjdk-6-jdk 或 openjdk-7-jdk。如果不需要 openjdk-6-jdk 和 openjdk-7-jdk,请卸载它们,然后使用以下命令安装 openjdk-8-jdk:

sudo apt install openjdk-8-jdk

希望安装 openjdk-6-jdk/openjdk-7-jdk 不会永久地弄乱您的 Java 路径,并且您可以立即开始使用 NetBeans。

在 Ubuntu 18.04 及更高版本中,默认 Ubuntu 存储库中的 NetBeans 版本为 10.0。

答案2

尝试一些其他 Linux World 原生的 IDE,例如 Geany 而不是 NetBeans。

请参阅此链接进行安装open-jdk如何在 Ubuntu 上编译.java 文件?

之后,您就可以使用 Geditjavac在终端中作为 java 编译器进行编码和命令。

相关内容