2

I recently installed the ubuntu 12.04 final beta

After installing the oracle jdk from the webupd8 ppa, launching eclipse failed complaining about a missing shared library.

Can't load library: /home/bob/.swt/lib/linux/x86_64/libswt-gtk-3740.so

I searched around, and found this quesion: Eclipse cannot load SWT libraries

As the OP recommended, I tried switching to open-jdk, and that worked wonderfully. The problem, however, is that I am working on a project that doesn't support openjdk.

I tried the second solution as well (the one by scott, which was just creating symbolic links to /usr/lib/jni/... in ~/.swt/lib/linux/x86_64/). Eclipse launches and everything is fine, but it still misses some libraries; this is what I get when i try to run my project:

Caused by: java.lang.UnsatisfiedLinkError: /tmp/libgdx/1352105074/libjogl_awt-linux64.so: libjawt.so: cannot open shared object file: No such file or directory

I know libjawt.so is somewhere on my computer:

$ locate libjawt.so
/usr/lib/jvm/java-6-openjdk-amd64/jre/lib/amd64/libjawt.so
/usr/lib/jvm/java-7-oracle/jre/lib/amd64/libjawt.so

But eclipse or java seems to think that libraries should be placed in ~/.swt/lib/linux/x86_64, isn't that weird?

Community
  • 1
  • 1
bobbaluba
  • 3,584
  • 2
  • 31
  • 45

3 Answers3

0

Eclipse when launched defaults to its own internal JRE, as I understand. I recommend the following:

  1. Modify your CLASSPATH variable to include the path to the desired libraries;
  2. Set your JAVA_HOME to match the actual JAVA_HOME;
  3. Setup Eclipse to launch from the desired JVM by customizing the eclipse.ini using this information: http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#eclipse.ini
  4. Also, can you specify the -classpath option when Eclipse is launched?
ingyhere
  • 11,818
  • 3
  • 38
  • 52
  • There's so many places to specify classpath. I tried several, but to no luck. What worked, though, was running ldconfig with the path to the missing libraries – bobbaluba Apr 26 '12 at 22:41
  • 1
    Right. That makes perfect sense. They are not Java libraries, but Linux libraries. I read the question too fast and forgot to mention the LD_LIBRARY_PATH, which might have also done the trick. Here is more information with a few options: http://stackoverflow.com/questions/4743233/is-usr-local-lib-searched-for-shared-libraries – ingyhere Apr 27 '12 at 01:21
  • Eclipse may use an internal JRE if shipped with one (IBM does this). The default downloads from Eclipse.org do not contain these, and relies on the default java command. – Thorbjørn Ravn Andersen Feb 22 '16 at 11:08
  • @ThorbjørnRavnAndersen -- That may be the case now, but four years ago when this was answered Eclipse came bundled with its own compiler and JRE. See http://stackoverflow.com/questions/4746341/do-i-need-to-install-java-sdk-if-i-have-eclipse . – ingyhere Feb 22 '16 at 22:55
  • @ingyhere Even then the JRE was not included in the download even if it included its own compiler. Please look for yourself in http://archive.eclipse.org/eclipse/downloads/ – Thorbjørn Ravn Andersen Feb 23 '16 at 08:53
0

Try downloading the latest version of Eclipse and running it. For some reason it works fine. I just ditched my older version of Eclipse. I hope this works for others!

mike boldischar
  • 175
  • 1
  • 1
  • 8
0

Please note that there are two Java runtimes in play here. The one used to run Eclipse itself, and the one you want to run your code. They do not have to be the same!

I would suggest

Now your own code is compiled against, and runs with Oracle Java.

Thorbjørn Ravn Andersen
  • 73,784
  • 33
  • 194
  • 347