本文介绍了如何使用Maven构建SWT应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着学习swt,我使用maven进行所有构建,并使用eclipse进行IDE。当从swven存储库中获取swt jar时,我得到:

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.<clinit>(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.<clinit>(Display.java:112)
    at wenzlick.test.swt.main.Main.main(Main.java:30)

有没有人成功获得使用maven构建和运行的swt应用程序?

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

推荐答案

听起来Maven正在推出一个旧版本的SWT。从v3.4(及更高版本)开始,swt.jar是您需要的所有。 SWT将自动提取 .so s, .jnilib s或 .dll s必要时。您需要担心的唯一棘手的事情是确保您获得正确的swt.jar(意味着您的平台)。

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).

尝试在本地存储库中安装SWT 3.4用手。如果这仍然给你同样的问题,那么一些东西可能是可疑的。之后,我会尝试手动提取 .so ,然后使用指定 java.library.path 变量 -D 启用调用。有时在Linux上,由于依赖性问题(例如libpango之类的东西),库的加载可能会失败。在这种情况下,错误通常只是泛型 UnsatisifedLinkError ,这使得问题难以调试。

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.

这篇关于如何使用Maven构建SWT应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-13 12:38