Search code examples
openglnetbeansprocessingjogl

Running P3D Processing sketch in JAR file, using Netbeans


I know there is a way to program with Processing P3D in an external IDE.

I have successfully been able to run 2D and P3D sketches within NetBeans IDE. But if I build the project to a JAR file with Processing P3D in my sketch, and try to run the JAR file, I get this error:

    java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\*****\natives\windows-i586\\gluegen-rt.dll

What can I do about this in order to make a Processing P3D sketch run in a JAR file? I know it has something to do with the JOGL library Processing uses, but I don’t know how to satisfy the error.


Sketch running fine in netbeans:

Processing P3D sketch running fine in netbeans 11.2

Sketch running as JAR file in Windows Powershell... :

Processing P3D sketch running as JAR file in Windows Powershell

Full error:

    java.lang.UnsatisfiedLinkError: Can't load library: C:\Users\*****\natives\windows-i586\\gluegen-rt.dll
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:624)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:106)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:487)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
        at com.jogamp.common.os.Platform$1.run(Platform.java:317)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:287)
        at com.jogamp.nativewindow.NativeWindowFactory$2.run(NativeWindowFactory.java:183)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.nativewindow.NativeWindowFactory.<clinit>(NativeWindowFactory.java:180)
        at com.jogamp.newt.NewtFactory$1.run(NewtFactory.java:68)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.newt.NewtFactory.<clinit>(NewtFactory.java:65)
        at processing.opengl.PSurfaceJOGL.initIcons(PSurfaceJOGL.java:498)
        at processing.opengl.PSurfaceJOGL.initFrame(PSurfaceJOGL.java:134)
        at processing.core.PApplet.initSurface(PApplet.java:11035)
        at processing.core.PApplet.runSketch(PApplet.java:10922)
        at processing.core.PApplet.main(PApplet.java:10657)
        at processing.core.PApplet.main(PApplet.java:10639)
        at com.JSF.processing.Main.main(Main.java:16)

Solution

  • Ok! I figured it out! I put all of the JAR files into a folder and added them to the class-path via Ant.

    Next I used ant to create a fat JAR with all of the classes in the classpath including the source code

    I ran the Jar in Windows powershell, and it works perfectly!