0

Possible Duplicate:
Eclipse cannot load SWT libraries

I have ubuntu 12.04 with the default jdk 1.6.0_24 and eclipse indigo 3.7.2. Now, for studies reasons, I must use the new java jdk 1.7.0_07 so I have updated the jdk like this:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

and java updated at 1.7.0_07 correctly. The problem is that now Eclipse is now working anymore. When I launch it i got this error:

An error has occurred. See the log file
/home/kira/.eclipse/org.eclipse.platform_3.7.0_155965261/configuration/1350235337372.log

And so I had to downgrade at java 1.6.0_24 again. I have also tried to install it by downloading the sources from oracle and then changing the PATH variable but the result is the same.

Why is eclipse not working anymore? Please help me, I'm going to start a project and I must use the new java. Here is the log:

!SESSION 2012-10-14 19:25:10.631 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0_07
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=it_IT
Command-line arguments:  -os linux -ws gtk -arch x86

!ENTRY org.eclipse.osgi 4 0 2012-10-14 19:25:14.472
!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/kira/.swt/lib/linux/x86/libswt-gtk-3740.so
Can't load library: /home/kira/.swt/lib/linux/x86/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:153)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at

org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) at org.eclipse.equinox.launcher.Main.run(Main.java:1410)

THANKS

Community
  • 1
  • 1
SagittariusA
  • 5,289
  • 15
  • 73
  • 127

2 Answers2

1

Eclipse can use a different JVM for your programs than the one it runs in itself (this is a very useful feature when maintaining old programs).

You can download Oracle Java for your platform directly from Oracle (the one that just unpacks to a dir, not the one intended to be installed by a package manager), and run it to accept the licence and unpack to a dir.

You can then add that dir to the Installed JRE's preference panel, and check it as the default JVM. Then your application will be compiled with that JVM instead of the one used to run Eclipse.

(and the reason for the error message is because Eclipse use native libraries (C instead of Java) which has been mismatched by your upgrade attempt)

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

you can run eclipse using java 1.6 and for your java project in eclipse you can configure jdk to java 1.7

to add java 7 to eclipse jre list, preferences > java > installed jre > Add and make it default

banjara
  • 3,800
  • 3
  • 38
  • 61