我正在尝试测试我开始使用WindowBuilder的GUI应用程序的基本结构。我也在使用Maven,以便我可以从他们的存储库中下载依赖项。
当我做一个" Maven Clean"时,我没有任何错误。或者" Maven Install",但是当我尝试执行" Run As ---> Java Application"时,我收到以下错误:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3044 in java.library.path
swt-win32-3044是我在Maven资源库中找到的,以满足WindowBuilder的要求。我的POM文件中没有任何错误,但这就是我所拥有的......
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>blah.blah.blah</groupId>
<artifactId>blah</artifactId>
<version>1.0.0</version>
<name>blah</name>
<dependencies>
<dependency>
<groupId>swt</groupId>
<artifactId>swt-win32</artifactId>
<version>3.0m8</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>java.library.path</name>
<value>${project.build.directory}</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
非常感谢任何帮助。感谢。
答案 0 :(得分:1)
所以我稍微改变了POM。我为WindowBuilder尝试了不同的Maven依赖,并改变了我定义maven-surefire-plugin的语法。
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>blah.blah.blah</groupId>
<artifactId>blah</artifactId>
<version>1.0.0</version>
<name>blah</name>
<dependencies>
<dependency>
<groupId>org.eclipse.swt</groupId>
<artifactId>org.eclipse.swt.win32.win32.x86_64</artifactId>
<version>4.3</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
现在按预期启动Java应用程序窗口。