Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library

What is the reason for the following error I am having:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library.

I am using Eclipse 3.5 SE on Ubuntu 9.04 Jaunty.

How can I resolve this error?

like image 547
javadahut Avatar asked Jun 06 '10 02:06

javadahut


3 Answers

I had same problem with Oracle Java 7 and Eclipse on 32-bit system.

libswt-gtk-3.6-java and libswt-gtk-3.6-jni were already installed. What helped:

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

Maybe this can be done reconfiguring Java alternatives or what.

like image 123
Victor Sergienko Avatar answered Nov 15 '22 06:11

Victor Sergienko


I believe Mikolaj Lechtanski's workaround is more elegant.

create or edit /etc/eclipse.ini

Paste inside:

-vmargs
-Djava.library.path=/usr/lib/jni

exit

make sure the file is readable:

sudo chmod 755 /etc/eclipse.ini
like image 41
Scott Severance Avatar answered Nov 15 '22 08:11

Scott Severance


This means the native libraries could not be found.
Either you have 32-bit libraries and you are running on a 64-bit machine or vice-versa.
also make sure you have the -Djava.library.path= set properly

See this page on how to run outside of eclipse

like image 37
Romain Hippeau Avatar answered Nov 15 '22 08:11

Romain Hippeau