libawt_xawt.so: libXext.so.6: cannot open shared object file: No such file or directory

Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/lib/java/jdk1.8.0_60/jre/lib/i386/libawt_xawt.so: libXext.so.6: cannot open shared object file: No such file or directory
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1821)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1938)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1842)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at java.awt.Toolkit$3.run(Toolkit.java:1636)
    at java.awt.Toolkit$3.run(Toolkit.java:1634)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.loadLibraries(Toolkit.java:1633)
    at java.awt.Toolkit.(Toolkit.java:1668)
    at java.awt.Component.(Component.java:593)
    at EventTest.(EventTest.java:28)
    at EventTest.main(EventTest.java:49)

Solution 1:

apt-get install libxrender1:i386 libxtst6:i386 libxi6:i386

helped me get this resolved.

I have installed in a 64 bit system also i386.

Solution 2:

Check which package contains the file and install it:

$ apt-file search libXext.so.6 
libxext6: /usr/lib/x86_64-linux-gnu/libXext.so.6 
libxext6: /usr/lib/x86_64-linux-gnu/libXext.so.6.4.0
libxext6-dbg: /usr/lib/debug/usr/lib/x86_64-linux-gnu/libXext.so.6.4.0 

So install libxext6:

sudo apt install libxext6