java创建swt design文件_使用eclipse新建一个SWT工程

在Windows 7 32位系统上,按照Eclipse教程创建SWT HelloWorld程序时遇到运行错误。错误提示为找不到swt-win32库。解决方案是进入项目的Java构建路径,找到Native Library Location,设置为 Workspace 中的org.eclipse.swt.win32.win32.x86,然后重新运行程序即可成功。
摘要由CSDN通过智能技术生成

照着eclipse的引导教程,新建一个swt的hello world程序。

我是一步一步跟着做的,但是编译通过却运行报错。

在网上找到了相似的情况,解决了,于是贴在这里。

问题:

n a WinDoze 7 Pro 32-bit machine, if I follow the instructions for creating a Hello World SWT example, it will work for Helios, but when I try it on Indigo, it fails with the following message:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:

no swt-win32-3735 in java.library.path

no swt-win32 in java.library.path

Can't load library: C:\Users\arick\.swt\lib\win32\x86\swt-win32-3735.dll

Can't load library: C:\Users\arick\.swt\lib\win32\x86\swt-win32.dll

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.(C.java:21)

at org.eclipse.swt.widgets.Display.(Display.java:138)

at HelloWorldSWT.main(HelloWorldSWT.java:12)

The project, org.eclipse.swt.win32.win32.x86 is in the build path of my HelloWorldSWT project. What I don't understand is why it is looking in my home directory for the SWT DLL?

解答:

Had Same initial issue and finally sorted it by...

Right click on project and go toProperties

InJava Build Pathunder theProjectstab there is the associated Project, in my caseorg.eclipse.swt.win32.win32.x86

Expand this down with the little arrow to the left to display the options. Here I foundNative Library Locations. This wasn't set so I selected it and clickedEdit.

In the Popup window that follows, I selectedWorkspaceand thenorg.eclipse.swt.win32.win32.x86.

Next time I ran the class, it work fine.

I hope this helps someone!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值