husker-dev / openglfx

OpenGL implementation for JavaFX
Apache License 2.0
80 stars 10 forks source link

LWJGL Running From Jar (UnsatisfiedLinkError) #16

Closed orange451 closed 2 years ago

orange451 commented 2 years ago

When packaging a FAT jar containing all of my libraries, I cannot execute using java -jar CLI method.

java.lang.UnsatisfiedLinkError: Failed to locate library: liblwjgl.dylib
    at org.lwjgl.system.Library.loadSystem(Library.java:164)
    at org.lwjgl.system.Library.loadSystem(Library.java:63)
    at org.lwjgl.system.Library.<clinit>(Library.java:51)
    at org.lwjgl.opengl.GL.<clinit>(GL.java:80)
    at com.huskerdev.openglfx.lwjgl.direct.LWJGLDirect.onNGRender(LWJGLDirect.kt:36)
    at com.huskerdev.openglfx.OpenGLCanvas$NGOpenGLCanvas.renderContent(OpenGLCanvas.kt:138)

The files required should be in the jar file though:

Screen Shot 2022-04-30 at 9 03 08 PM
orange451 commented 2 years ago

I am packaging the fat jar using:

<!-- FAT Jar (mvn clean package) -->
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>3.1.1</version>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
        <archive>
            <manifest>
                <mainClass>dev.anarchy.Main</mainClass>
            </manifest>
        </archive>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>
orange451 commented 2 years ago

Repro: https://github.com/orange451/OpenGLFX-LWJGL-Sample

orange451 commented 2 years ago

If you feel this is not relevant to your project, let me know! If that's the case, I'll ask on LWJGL repo

husker-dev commented 2 years ago

I don’t think it is related to my project. It doesn’t contain lwjgl library code or files

orange451 commented 2 years ago

I will do some more digging and post the solution here if I find it.

husker-dev commented 2 years ago

I will close this issue as it is not really related to openglfx. You can reopen if needed