22
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)
karel
  • 122,695
  • 134
  • 305
  • 337

3 Answers3

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

helped me get this resolved.

I have installed in a 64 bit system also i386.

David Foerster
  • 36,900
  • 56
  • 98
  • 152
  • 4
    This worked for me where the other answers would not. Thanks. – a coder Aug 11 '17 at 20:34
  • For sure this is correct answer if you're running i386 version of JRE or any other software which depends on this set of libs. You always must match architecture between runtime and shared libs. – stamster Feb 09 '18 at 21:16
  • I had to launch 'sudo dpkg --add-architecture i386' command then 'sudo apt-get update' before to be able to install i386 versions of libraries – quent Dec 07 '20 at 14:17
18

I had to install this (on ubuntu 16.04 64 bit) to make oracle-jdk8 work:

sudo apt-get install libxrender1 libxtst6 libxi6
TmTron
  • 456
  • 1
    I do not know what, but this fixed my problems after trying hundreds of other apt install whatever commands from other answers! – team17 Dec 19 '19 at 10:33
  • Thanks. Using https://packages.ubuntu.com/ and looking for the packages containing the missing files, I found that sudo apt-get install libxext6 libxrender1 libxtst6 libxi6 --no-install-recommends -y solved the problem. I can now run the JavaFX App in docker. – Eric Duminil Oct 16 '24 at 09:05
17

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
A.B.
  • 92,275
JdeHaan
  • 509