Centos 安装Eclipse报错java.lang.UnsatisfiedLinkError: Could not load SWT library

前端之家收集整理的这篇文章主要介绍了Centos 安装Eclipse报错java.lang.UnsatisfiedLinkError: Could not load SWT library前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
@H_403_0@

在CentOs上安装Eclipse时报错:

!ENTRY org.eclipse.osgi 4 0 2017-08-15 00:22:12.612
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    /home/badou/app/eclipse/configuration/org.eclipse.osgi/744/0/.cp/libswt-pi-gtk-4527.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory
    no swt-pi-gtk in java.library.path
    Can't load library: /home/badou/.swt/lib/linux/x86/libswt-pi-gtk-4527.so
    Can't load library: /home/badou/.swt/lib/linux/x86/libswt-pi-gtk.so
    /home/badou/.swt/lib/linux/x86/libswt-pi-gtk-4527.so: libgtk-x11-2.0.so.0: cannot open shared object file: No such file or directory

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:327)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:236)
    at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:38)
    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:134)
    at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:734)
    at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:162)
    at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:169)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:111)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    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:606)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)

原因是缺少SWT library,在联网的情况下执行一下命令:

yum install gtk2.i686 gtk2-engines.i686 PackageKit-gtk-module.i686 PackageKit-gtk-module.x86_64 libcanberra-gtk2.x86_64 libcanberra-gtk2.i686

重启Eclipse,就可以了

猜你在找的CentOS相关文章