简体   繁体   English

无法在Mac中加载Eclipse中的SWT库

[英]Could not load SWT library in Eclipse in Mac

When I tried to run a plug-in project as Eclipse Application, I get following error. 当我尝试将插件项目作为Eclipse Application运行时,出现以下错误。

eclipse.buildId=unknown
java.version=1.8.0_152
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.platform.ide
Command-line arguments:  -product org.eclipse.platform.ide -data /{HOME}/eclipse-workspace/../runtime-New_configuration -dev file:/{HOME}/eclipse-workspace/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties -os win32 -ws win32 -arc$

!ENTRY org.eclipse.osgi 4 0 2017-12-07 23:43:27.145
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
        no swt-win32-4530 in java.library.path
        no swt-win32 in java.library.path
        Can't load library: /{HOME}/.swt/lib/macosx/x86_64/libswt-win32-4530.jnilib
        Can't load library: /{HOME}/.swt/lib/macosx/x86_64/libswt-win32.jnilib

        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.C.<clinit>(C.java:16)
        at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
        at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:774)
        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:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)

Then, I found out that the folder "/{HOME}/.swt/lib/macosx/x86_64" acctually is empty. 然后,我发现文件夹“/{HOME}/.swt/lib/macosx/x86_64”实际上是空的。 I guess this is the reason, but I do not know how to reinstall SWT(I have googled a while though) 我想这就是原因,但我不知道如何重新安装SWT(虽然我已经google了一段时间)

Eclipse Version: Oxygen.1a Release (4.7.1a) (64-bit) Eclipse版本:Oxygen.1a版本(4.7.1a)(64位)

Java Version: Java版本:

java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

Mac Version: 10.12 (64-bit) Mac版本:10.12(64位)

The command line arguments: 命令行参数:

-os win32 -ws win32

show that you are trying to run this as a Windows application - which isn't going to work on macOS 表明您正在尝试将其作为Windows应用程序运行 - 这不适用于macOS

Check that the Arguments tab of the Run Configuration has something like: 检查运行配置的Arguments选项卡是否具有以下内容:

-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} 

in the program arguments and that the 'Environment' section of your current Target Platform is blank or specifies macOS. 在程序参数中,当前目标平台的“环境”部分为空或指定macOS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM