Skip to content
[dk]

~/blog/ubuntu-eclipse-launch-error.md

Error When Launching Eclipse on Ubuntu

Recently I decided to try IntelliJ and installed Oracle JDK, but it seems to interact poorly with Eclipse.

If you launch Eclipse using Oracle Java 7, an error occurs. When I checked the log, I found entries like the following. It looked as though SWT could not be loaded.

eclipse.buildId=I20110613-1736
java.version=1.7.0_07
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments:  -os linux -ws gtk -arch x86

!ENTRY org.eclipse.osgi 4 0 2012-10-13 15:40:35.418
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
 no swt-gtk-3740 in java.library.path
 no swt-gtk in java.library.path
 Can't load library: /home/daisuke/.swt/lib/linux/x86/libswt-gtk-3740.so
 Can't load library: /home/daisuke/.swt/lib/linux/x86/libswt-gtk.so

The solution seems to be switching the JRE back to an OpenJDK one. Run the command below from a terminal and change it.

$ sudo update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-7-oracle/jre/bin/java         1062      auto mode
  1            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      manual mode
  2            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode
  3            /usr/lib/jvm/java-7-oracle/jre/bin/java         1062      manual mode

Press enter to keep the current choice[*], or type selection number:

$ related --same-tags