Can't set library path

I’m having trouble writing an ant script to run a program that uses JOGL JSR 231 under NetBeans. Setting -Djava.libraray.path= isn’t working.

First, I added jogl.dll, jogl_cg.dll and jogl_awt.dll to <java_home>/jre/bin. I then compiled an ran the demo gears problem. This worked.

Wanting to try again with a method that would not involve me hacking the JDK, I closed NetBeans, deleted these dlls from and restarted NetBeans.

Next, I unzipped jogl-natives-windows-i586.jar into a directory.I then wrote the following Ant script:

    <!--property name="run.library.path" location="C:\dev\cvs.kitfox.com\PantometricsEditor\lib\jogl\jogl-natives-windows-i586.jar"/-->
    <property name="run.library.path" location="C:\dev\cvs.kitfox.com\PantometricsEditor\lib\jogl\dll"/>
    
    <java classname="${project.run.mainClass}" fork="true" jvm="${project.run.jvm}">
        <jvmarg value="-ea"/>
        <jvmarg value="-Djogl.verbose"/>
        <jvmarg value="-Djava.library.path=&quot;${run.library.path}&quot;"/>
        <jvmarg value="-Xmx256M"/>
        <classpath>
            <pathelement location="${classes.dir}"/>
            <path refid="path.classpath"/>
        </classpath>
    </java>

I’ve tried lots of variations of the above, but all are failing. I know that my DLLs are in the directory I’m specifying, and System.out.println(System.getProperty(“java.library.path”)); is showing that the path name is being passed correctly. None the less, I’m getting the below error. What am I doing wrong?

Exception in thread “Thread-2” javax.media.opengl.GLException: java.lang.UnsatisfiedLinkError: com.sun.opengl.impl.windows.WGL.GetPixelFormat(J)I
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at com.sun.opengl.util.Animator.display(Animator.java:144)
at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.UnsatisfiedLinkError: com.sun.opengl.impl.windows.WGL.GetPixelFormat(J)I
at com.sun.opengl.impl.windows.WGL.GetPixelFormat(Native Method)
at com.sun.opengl.impl.windows.WindowsGLDrawable.choosePixelFormat(WindowsGLDrawable.java:81)
at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:202)
at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:127)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:598)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread “AWT-EventQueue-0” javax.media.opengl.GLException: Attempt to make the same context current twice on thread Thread[AWT-EventQueue-0,6,main]
at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:124)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
at sun.awt.RepaintArea.paint(RepaintArea.java:224)
at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:293)
at java.awt.Component.dispatchEventImpl(Component.java:4483)
at java.awt.Component.dispatchEvent(Component.java:4237)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:600)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
BUILD SUCCESSFUL (total time: 21 seconds)

I tried a simple build.xml based on your example and it worked fine. My best guess is that you have a mismatched jogl.jar and jogl.dll. Otherwise you would probably see a different exception being thrown.