3

Hey I am trying to execute Netbeans 12.4 on ubuntu 20.04.1 and getting this error my java version is openjdk 16.0.1 can anybody help me to fix this error ?

java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-16-openjdk-amd64/lib/libawt_xawt.so
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2387)
    at java.base/java.lang.Runtime.load0(Runtime.java:746)
    at java.base/java.lang.System.load(System.java:1857)
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
    at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:310)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:280)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2392)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:808)
    at java.base/java.lang.System.loadLibrary(System.java:1893)
    at java.desktop/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:61)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
    at java.desktop/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:58)
    at java.desktop/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:36)
    at java.desktop/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93)
    at java.desktop/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:84)
    at java.desktop/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106)
    at org.netbeans.core.startup.Main.start(Main.java:228)
    at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
    at java.base/java.lang.Thread.run(Thread.java:831)
Aayush Joshi
  • 37
  • 1
  • 2

2 Answers2

4

Answering this question for future users.

I had same issue with JDK 17 because I had installed headless JDK. May this package wasn't included within headless JDK. I resolved this issue by updating my JDK using commands below. Please don't forget to replace you JDK version on command.

sudo apt update

sudo apt install openjdk-17-jdk

Roshan Garu
  • 41
  • 1
  • 2
0

Setting the java.awt.headless to true, for example during static initialisation of the class, might help, depending on what you want to do:

    static {
        System.setProperty("java.awt.headless", "true");
    }

It helped for me. :)