Exception JOGL using wrong library?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Exception JOGL using wrong library?

adanecito
Hi All,
I am using JOGL for the Mac OSX and when open a JPanel that uses it I get an exception about not having a native library but the library is the windows one. I am using Java 1.7.0_45 for the Mac and JOGL 2.1.0 Implementation version, 2.1 Specification Version and 2.1-b1111-20131010 Implementation build. Why would the JOGL library on the Mac ask for a windows native library? Here is the exception trace.

Here is the trace when the exception is thrown:




NLPClassLoader: Finding library libnativewindow_awt.dylib

JNLPClassLoader: Finding library libnativewindow_awt.dylib

JNLPClassLoader: Finding library libnativewindow_awt.dylib

Exception in thread "AWT-EventQueue-2" java.lang.UnsatisfiedLinkError: Can't load library: /System/Library/Frameworks/nativewindow_awt.Framework/nativewindow_awt

         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1817)

         at java.lang.Runtime.load0(Runtime.java:809)

         at java.lang.System.load(System.java:1083)

         at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:548)

         at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:64)

         at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:95)

         at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:412)

         at jogamp.nativewindow.NWJNILibLoader.access$000(NWJNILibLoader.java:39)

         at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:48)

         at jogamp.nativewindow.NWJNILibLoader$1.run(NWJNILibLoader.java:41)

         at java.security.AccessController.doPrivileged(Native Method)

         at jogamp.nativewindow.NWJNILibLoader.loadNativeWindow(NWJNILibLoader.java:41)

         at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:300)


         at java.lang.Class.forName0(Native Method)

         at java.lang.Class.forName(Class.java:340)

         at javax.media.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:323)

         at javax.media.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:320)

         at java.security.AccessController.doPrivileged(Native Method)

         at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:320)

         at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1495)

         at javax.media.opengl.GLProfile.access$100(GLProfile.java:76)

         at javax.media.opengl.GLProfile$1.run(GLProfile.java:153)

         at java.security.AccessController.doPrivileged(Native Method)

         at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:123)

         at javax.media.opengl.GLProfile.getProfileMap(GLProfile.java:2013)

         at javax.media.opengl.GLProfile.get(GLProfile.java:892)

         at javax.media.opengl.GLProfile.get(GLProfile.java:921)

         at javax.media.opengl.GLProfile.getMaxFixedFunc(GLProfile.java:674)

         at gov.nasa.worldwind.Configuration.getMaxCompatibleGLProfile(Unknown Source)

         at gov.nasa.worldwind.Configuration.getRequiredGLCapabilities(Unknown Source)



         at gov.nasa.worldwind.awt.WorldWindowGLJPanel.<init>(Unknown Source)

Thanks for any help.
-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

gouessej
Administrator
Hi

Please check whether another version of JOGL is installed as an extension on your machine. I always advise JOGL users to avoid installing it as an extension under Mac but unfortunately, some of them go on doing so... JOGL shouldn't be installed in /System/Library/Frameworks. If the version of JOGL in this directory isn't the same than the one used by Java Webstart, bad things will happen.

Edit.: It's not asking a library for Windows, it's looking for "nativewindow_awt" native library.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Thanks. How do I do that on the Mac?
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Ok I found the extensions path as mentioned in this message: http://stackoverflow.com/questions/16380159/how-to-load-native-jogl-jnilib-extensions-on-mac-osx-by-exported-app-jar

But I see no jar that looks like a jogl jar. So I am thinking that there is some issue when using Java Web Start with JOGL and the Mac. I am using the JNLP file and have the jogl, gluegen and the associated natives in separate jars. From the link above for linux it seems to mention having the jars next to each other and I am wondering if I have to do something special for JOGL.

So do I need to save the natives on the disk outside of the jar and point to them via a NativeLibrary to add to some sort of system path?

Regards,
-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

gouessej
Administrator
If your Java Webstart application is correctly configured and if its JNLP file contains the JOGL extension or if it points to JOGL JARs, you have nothing more to do. I have used JOGL with Java Webstart since 2006, it just works and I tested under Mac OS X too. Rather look at Xerxes' answer which is correct:
http://stackoverflow.com/a/16387004

There is no special step. Just follow our advises and ensure that you have never installed any other JOGL version anywhere on your machine. What do you put into your JNLP file?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Ok here is part of my jogl file.

<resources os="Mac OS X" arch="x86_64">
      <j2se version="1.7+" href="http://java.sun.com/products/autodl/j2se" java-vm-args="-Xmx300m -Dsun.awt.disableMixing=true" />
      <jar href="lib/jogl.jar"/>
      <jar href="lib/gluegen-rt.jar"/>
      <nativelib href = "lib/jogl-natives-macosx-universal.jar" />
      <nativelib href = "lib/gluegen-rt-natives-macosx-universal.jar" />
</resources>

You can get to it via:
http://www.myuniportal.com/MyUniPortalMap/MyUniPortalMap.jnlp

The Mac is new and I have installed jre 1.7.0_45 and eclipse. Funny thing is eclipse works just fine the libraries but not via web start.

Thanks,
-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

gouessej
Administrator
Sorry but it's obviously wrong. "jogl.jar" doesn't exist in JOGL 2. You should use jogl-all.jar. "nativelib" shouldn't be used as JOGL uses its own mechanism. You should have looked at my JNLP files ;)
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Actually I am using your gogl-all I just renamed it. :-) Also, the example jnlp I saw had the nativelib entries. Here it is:

<resources os="Mac OS X" arch="x86_64">
    <nativelib href="jar/jogl-all-natives-macosx-universal.jar"/>
  </resources>


I am using the jogl jars that WWJ (Worldwind Java) supplies that they tested against thier worlwind.jar.


So you are saying the jar listed above is not needed for jogl? I will see if I get any errors without it.

Many Thanks,
-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Ok I removed the nativelib entry and I still get the same error. In eclipse with that library removed it works fine.

I will keep pluging away. :-)

-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

adanecito
Works fine now. I had to uninstall 1.7.0_45 and install 1.7.0_51.

Thanks for the help. What are those native libs jars for anyway?

Thanks,
-Tony
Reply | Threaded
Open this post in threaded view
|

Re: Exception JOGL using wrong library?

gouessej
Administrator
Hi

Maybe you used wrong examples or examples based on an obsolete version of Worldwind relying on JOGL 1. Renaming JOGL JARs isn't a good idea.

Oops, my JNLP files work even though I use "nativelib".

JOGL and GlueGen have both Java classes and some C code, they need to use low level platform dependent features, that's why they have a native "part". Their native libraries are stored into separate JARs to ease the deployment. As it is forbidden to load a native library directly from a JAR, they are extracted into a temporary directory and loaded. If you don't provide those JARs, JOGL can't work.
Julien Gouesse | Personal blog | Website