snowfi6916
snowfi6916

Reputation: 697

Getting "Unsatisfied Link" Error When Trying to Run Java Application Using Maven and WindowBuilder

I am trying to test the basic structure of my GUI application that I started using WindowBuilder. I am also using Maven so that I can just download the dependencies from their repository.

I don't have any errors when I do a "Maven Clean" or a "Maven Install", but when I try to do "Run As--->Java Application", I get the following error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no swt-win32-3044 in java.library.path

swt-win32-3044 was what I found in the Maven Repository to satisfy the requirements for the WindowBuilder. I don't have any errors in my POM file, but here is what I have...

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

Any help would be greatly appreciated. Thanks.

Upvotes: 1

Views: 831

Answers (1)

snowfi6916
snowfi6916

Reputation: 697

So I changed the POM around a little bit. I tried a different Maven dependency for WindowBuilder and changed my syntax for defining the 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>

It now launches the Java application window as expected.

Upvotes: 1

Related Questions