java swt maven,如何使用Maven构建SWT应用程序

I trying to learn swt, and I use maven for all my builds and eclipse for my IDE. When getting the swt jars out of the maven repository, I get:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3034 in java.library.path

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)

at java.lang.Runtime.loadLibrary0(Runtime.java:823)

at java.lang.System.loadLibrary(System.java:1030)

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:100)

at org.eclipse.swt.internal.gtk.OS.(OS.java:19)

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.(Display.java:112)

at wenzlick.test.swt.main.Main.main(Main.java:30)

Has anyone successfully got a swt app to build and run using maven?

Edit: I did a little research and found the problem. look at my post below

解决方案

Sounds like Maven is pulling in an old version of SWT. As of v3.4 (and higher), the swt.jar is all you need. SWT will automatically extract the .sos, .jnilibs or .dlls as necessary. The only tricky thing you need to worry about is to ensure that you get the right swt.jar (meaning for your platform).

Try installing SWT 3.4 in your local repository by hand. If that still gives you the same problem, then something is probably fishy. After that, I would try extracting the .sos manually and then specifying the java.library.path variable using the -D switch on invocation. Sometimes on Linux the loading of the libraries can fail due to dependency problems (in things like libpango). In such cases, often the error will be just the generic UnsatisifedLinkError, making the problem difficult to debug.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值