I occasionally use Java from the terminal to run TightVNC. Today when I tried I got a bunch of errors. I tried another program (FIBS) and got the same error. These programs did run properly last time I used them. So I rebooted to UbuntuMate 18.04, both programs still run fine. So did Java change? I was hoping someone could make sense of my issue. Below is my terminal output:
@UM20:~/Desktop/temp/JavaFIBS2001$ java -jar JavaFIBS-1.0.12_java16.jar JavaFIBS2001
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2630)
at java.base/java.lang.Runtime.load0(Runtime.java:768)
at java.base/java.lang.System.load(System.java:1837)
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1399)
at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1397)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1396)
at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1429)
at java.desktop/java.awt.Component.<clinit>(Component.java:621)
at JavaFIBS2001.main(Unknown Source)
@UM20:~/Desktop/temp$ java -jar tightvnc-jviewer.jar
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2630)
at java.base/java.lang.Runtime.load0(Runtime.java:768)
at java.base/java.lang.System.load(System.java:1837)
at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2648)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:830)
at java.base/java.lang.System.loadLibrary(System.java:1873)
at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1399)
at java.desktop/java.awt.Toolkit$3.run(Toolkit.java:1397)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1396)
at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1429)
at java.desktop/java.awt.Component.<clinit>(Component.java:621)
@UM20:~/Desktop/temp$
the error shows it could not load java-11 so verify which java you have on 20.04 (java --version). Do the same on 18.04 and install the same version so that tightvnc can work. You can switch between java versions on your system with sudo update-alternatives --config java
There is not much difference between versions. build 11.0.11+9 vice build 11.0.10+9, Was there a significant change in the 20 April update? Also, how would I install build 11.0.10+9 alongside 11.0.11+9?
On your Ubuntu MATE 20.04 system which exhibits the Java error, try the command:
ls -l /usr/lib/jvm/java-11-openjdk-amd64/lib/libawt_xawt.so
I want to see whether the file is missing entirely, or if it's a broken symlink. If the former, then that command should fail with a "No such file or directory" error. If the latter, then ls should display the link in red.
If the above command fails, list off the contents of the parent directory:
I see. Now what? Can I fix java? Should I remove and re-install. I am confused what has gone wrong to begin with. I assume something changed with the 20 April update?
Thank you. When I reinstalled, 5 new packages were installed. I get the same results as before when checking Java version. However, all works now. I don't know what broke the previous installation, but thanks again for helping me correct the problem.