java - Eclipse cannot load SWT libraries

ID : 10323

viewed : 32

Tags : javaeclipseubuntuunsatisfiedlinkerrorjava

Top 5 Answer for java - Eclipse cannot load SWT libraries

vote vote


on my Ubuntu 12.04 32 bit. I edit the command to:

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/ 

And on Ubuntu 12.04 64 bit try:

ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/ 
vote vote



Because I had installed the Oracle Java 7 it had changed the default Java to Oracle Java 7, however it needed to be the Open JDK.

To fix, open up terminal and type

sudo update-alternatives --config java 

This brings up a list of the different types of Java. Simply select the Open JDK.

vote vote


Simply specify the path to the libraries:

echo "-Djava.library.path=/usr/lib/jni/" >> /etc/eclipse.ini 
vote vote


In my case, I was missing the /usr/lib/jni directory entirely. Fixed by

sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java 

No need to symlink afterwards. Eclipse started normally.

vote vote


For Windows Subsystem for Linux (WSL) you'll need

apt install libswt-gtk-4-jni 

If you don't have an OpenJDK 8 you'll also need

apt install openjdk-8-jdk 

Top 3 video Explaining java - Eclipse cannot load SWT libraries