无法在Ubuntu 12.04中打开Eclipse - java.lang.UnsatisfiedLinkError:无法加载SWT库

时间:2012-06-10 17:31:13

标签: eclipse swt ubuntu-12.04

我新安装了Ubuntu 12.04。我也安装了Java 7.我尝试安装eclipse-java-indigo-SR2-linux-gtk.tar.gz。我在/ home / ramprabhu位置提取了这个文件。然后我尝试运行eclipse可执行文件。我看到日志文件时出错了。

我的日志文件:

 !SESSION 2012-06-10 22:47:35.959 -----------------------------------------------
eclipse.buildId=M20120208-0800
java.version=1.7.0_04
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.java.product
Command-line arguments:  -os linux -ws gtk -arch x86 -product org.eclipse.epp.package.java.product

!ENTRY org.eclipse.osgi 4 0 2012-06-10 22:47:36.757
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    /home/ramprabhu/eclipse/configuration/org.eclipse.osgi/bundles/247/1/.cp/libswt-pi-gtk-3740.so: libXtst.so.6: cannot open shared object file: No such file or directory
    no swt-pi-gtk in java.library.path
    /home/ramprabhu/.swt/lib/linux/x86/libswt-pi-gtk-3740.so: /home/ramprabhu/.swt/lib/linux/x86/libswt-pi-gtk-3740.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
    Can't load library: /home/ramprabhu/.swt/lib/linux/x86/libswt-pi-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.gtk.OS.<clinit>(OS.java:22)
    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)

我无法运行eclipse。如何解决这个问题并运行eclipse。

7 个答案:

答案 0 :(得分:55)

尝试使用以下命令

  • 64位系统:ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

  • 32位系统:ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

答案 1 :(得分:7)

通过将libswt文件复制到~/.swt/lib/linux/x86(or x86_64)

来解决问题

代表32位:

/bin/cp /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

代表64位:

/bin/cp /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

答案 2 :(得分:5)

当我试图在64位linux下启动32位Eclipse时,我遇到了这个错误。安装 ia32-libs 包后,问题就解决了。

答案 3 :(得分:4)

在为Blackberry 10开发安装QNX Momentic IDE(基于32位eclipse发行版)后,我遇到了这个问题。我没有机会安装ia32-libs,因为

  

$ sudo apt-get install ia32-libs   阅读包裹清单......完成   建立依赖树
  阅读国家信息......完成   包ia32-libs不可用,但是由另一个包引用。   这可能意味着包裹丢失,已经过时或者   仅可从其他来源获得   但是,以下包替换它:     lib32asound2 lib32z1 lib32ncurses5 lib32bz2-1.0

     

E:包'ia32-libs'没有安装候选者

我在this post

中找到了解决方案
  

sudo aptitude install libc6:i386 libstdc ++ 6:i386 libatk1.0-0:i386 libc6:i386 libcairo2:i386 libexpat1:i386 libffi6:i386 libfontconfig1:i386 libfreetype6:i386 libgcc1:i386 libgdk-pixbuf2.0-0 :i386 libglib2.0-0:i386 libgtk2.0-0:i386 libpango1.0-0:i386 libpcre3:i386 libpixman-1-0:i386 libpng12-0:i386 libselinux1:i386 libstdc ++ 6:i386 libx11-6 :i386 libxau6:i386 libxcb1:i386 libxcb-render0:i386 libxcb-shm0:i386 libxcomposite1:i386 libxcursor1:i386 libxdamage1:i386 libxdmcp6:i386 libxext6:i386 libxfixes3:i386 libxi6:i386 libxinerama1:i386 libxrandr2:i386 libxrender1:i386 libxtst6: i386 zlib1g:i386

我确信这个解决方案也有助于简单的32位日食

答案 4 :(得分:3)

您正在混合使用64位和32位。下载64位版本的Eclipse并使用64位版本的Java 7。

答案 5 :(得分:3)

以下是我如何解决这个问题 aptitude search libswt-gtk

然后sudo apt-get install未安装的那些 enter image description here

答案 6 :(得分:0)

与我的64位系统有同样的问题,ln是解决方案工作,魔术, 64位系统:ln -s / usr / lib / jni / libswt- *〜/ .swt / lib / linux / x86_64 /