chrisdchristo / capsule-maven-plugin

Capsule Maven Plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnsatisfiedLinkError

oparisy opened this issue · comments

Hi, I am using maven to build a small program depending on org.lwjgl.lwjgl:lwjgl:2.9.1.

Up to now, I have been using maven-nativedependencies-plugin to unpack the native libraries provided by lwjgl, and have been able to run my code sucessfully using -Djava.library.path=target/natives, as suggested here.

I would now like to build a fat capsule, which would enable me to run my program without specifying -Djava.library.path on the command line. What should I do for this purpose?

For now:

  • The capsule properly embarks at its root the jars containing the native libraries (lwjgl-platform-2.9.1-natives-windows.jar as an example, which contains lwjgl.dll).
  • I get an UnsatisfiedLinkError: no lwjgl in java.library.path when running the jar.

Here is the relevant POM fragment:

            <plugin>
                <groupId>com.github.chrischristo</groupId>
                <artifactId>capsule-maven-plugin</artifactId>
                <version>0.10.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <configuration>
                            <appClass>org.lwjgl.examples.spaceinvaders.Game</appClass>
                            <types>fat</types>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

I finally switched to Gradle for this packaging task but, for reference, I got this to work by copying the extracted native libraries to the Capsule root, and filtering out the jars containing them (which are not needed anymore).

The Capsule loader points java.library.path to the folder where it unpacks the Capsule content, so this runs out of the box.

Regards.

Edit: I shared the resulting script here: https://github.com/oparisy/lwjgl-packaging.

Hmm ok thanks for letting me know, will look into this.