JOGL Binaries Question

I’m really new to openGL and Java. I’m running a box with XP and I was wondering where I’d have to put the binaries for JOGL and what I’d have to change on my system in order to use it with Eclipse. Sorry if its a stupid question, but I’m clueless at the moment.

No biggie. I’ll put a tutorial doc together this weekend to help out the newbies, but herre is the gist of it.

JOGL has two pieces: a java part, and a native part.

The jogl.jar piece has to be in you classpath. In Eclipse, IntelliJ, etc. you simply add it as a regular library. This will allow you to build your applications.

Then there is a native piece while (on Windows) will be a jogl.dll or on Linux be a jogl.so or on OSX be a libjogl.jnilib. This needs to be in your java.library.path. There are a couple of ways to put that native library in the right place. You can write a quickie program that does:

System.out.println( System.getProperty(“java.library.path”) );

Then look at the directories that come out and drop it there. This would be more ideal when jogl has matured a bit more or when there is an installer (in the works).

The other option is to put it into the directory where your IDE is running your application. java.library.path almost always (at least I have never run across an instance where this wasn’t the case) includes “.” as a directory. This means that you just need to put the native library in the directory where the application is running. For intelliJ this simply means adding the native library to the project root and it just works. This may also be the case for Eclipse as well, but since it still blows chunks on OSX (yes even 3.0 still has issues) I couldn’t tell ya.

If you really just want to get up and running quickly on Windows, dump the library into your /{windows.homedirectory}/system32 directory and you’re good to go. You just need to remember that you put it there because nothing will annoy you more than coming back later and installing a new version of the native piece somewhere else and having System.loadLibrary load the wrong library.

One final thing that should work, which I haven’t tried with jogl is to simply do a System.load() with the absolute path to where you put the native library. I used to do this with my own native libraries on Windows and it worked, but again this is also not one of my favorite choices.

hey, I’ve seen this topic before :slight_smile:

Is it ok to go ahead and load the native libraries yourself? Does the jvm not care if someone attempts to reload an already loaded native library? Because for my app I have a lib directory I stick all these things and I’d like to be able to just load jogl along with everything else.

IIRC the native library will only get loaded once no matter how many times System.loadLibrary() is called. In either event, it doesn’t result in an exception being through as I have just done a quick test with System.loadLibrary(“jogl”) being called 5 times with no apparent ill effect.

If however its smart enough to load the library multiple times but stupid enough to not throw an exception (or use a hashtable for the libraries loaded such that it unloads the one already loaded), then that deserves bug status with Sun ;D

Who is working on the installer? Is it an InstallAnywhere installer or something different? Is someone working on a WebStart extension installer?

If you want to have got Jogl in your JRE (JDK) just put the two files here:


Jre/bin/jogl.dll
Jre/lib/ext/jogl.jar

The two files can be found here: http://jogl.dev.java.net/servlets/ProjectDocumentList?folderID=128

If you want to give your application as a JAR file to somebody else, just put the two files next to your JAR. For example:


Myapplication.jar
jogl.dll
jogl.jar

Then a double click on your Myapplication.jar or the usual “java -jar Myapplication.jar” will do the job.
(It’s not neccessary to set any classpath variable in the Win32/dosbox environment).

P.S. The point I don’t understand is why I haven’t to include the “.” into the classpath of Java. I could bet I had to do so with Java 1.1.x in former times. Is this some “magic” in Java 1.4.2 to automatically always search the “.” directory, too? Btw, there really is no CLASSPATH variable set here. :slight_smile:

[quote]Who is working on the installer? Is it an InstallAnywhere installer or something different? Is someone working on a WebStart extension installer?
[/quote]
We just got the certificate today which will allow us to post signed jars that developers can link to directly in their Java Web Start JNLP files. This should be the most automatic form of installation and distribution. Will work on getting these up next week.

I am working on an Installer for installing the native libraries as we speak in order to allow these libraries to be just like good old native libraries and accessible (I expect) from a web browser just like Flash.

[quote]We just got the certificate today which will allow us to post signed jars that developers can link to directly in their Java Web Start JNLP files. This should be the most automatic form of installation and distribution. Will work on getting these up next week.
[/quote]
That is very good news! I like JOGl more and more.

Note installer uses Install Anywhere 5.5.

[quote]We just got the certificate today which will allow us to post signed jars that developers can link to directly in their Java Web Start JNLP files.
[/quote]
If the JOGL jar file is signed by your certificate and my code is signed by my certificate that means the user must confirm that they want to allow each component to have full access to the system in two separate security dialogs - right?

I would like to see a Web Start extension installer as well, so that JOGL can be installed on a system once, then every other Web Start app that needs it won’t even need to download it as long as it is up to date.

How will the Mac version deal with systems that don’t have OpenAL installed? Will users need to install it separately?

JOAL hasn’t gotten the special treatment that JOGL has, but OpenAL is a native library just like libjogl.jnilib and can be installed in a similar manner. Its just a openal.framework that needs to be plopped into the frameworks directory. No funky registry idiocy and the like. OSX makes installing software easy. if you can figure out where its supposed to go, just move the file there :slight_smile:

I only mention OpenAL because when I ran the installer for it, it placed the framework in /Library/Frameworks/ whereas most of the OS X frameworks seem to go to /System/Library/Frameworks. When working on OpenAL support in LWJGL I couldn’t find a OS X API that returned the /Library/Frameworks path and had trouble loading the framework until I moved it.

I think it makes sense to install the OpenAL framework in a manner consistent with the OpenAL installer… so that things don’t get messed up with multiple copies of the same framework.

With most things for OSX it depends on whether or not you are running as root or a user with true root permissions. If you’re not running as root it will not try to install anything into a system directory because your user account wouldn’t have permission to do so anyways. As such it installs them into the user libraries (a good architectural approach) directory. It might be worthwhile to bring that up with the OpenAL folks.

The intent is to have it referenced as a Web Start extension as you suggest so that it is shared among applications and has its own security domain. Note that this implies that end-user applications wouldn’t necessarily need to be signed. I don’t know exactly how to do this yet but will try to figure it out this week.

I think you will want something like this… (once the installer is ready for each platform)
This jnlp file would be referenced from the applications jnlp file as an extension installer. I think the os string for Mac will need to be modified to only recognize OS X 10.3 and above, unless a 10.2 compatible version of JOGL is produced.


<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://games.dev.java.net/blah" href="JOGL.jnlp">
      <information>
            <title>JOGL</title>
            <vendor>Game Technologies Group, Sun Microsystems inc.</vendor>
            <homepage href="index.html"/>
            <description kind="short">Native bindings for OpenGL</description>
            <description>This extension privides access to OpenGL functions from Java.</description>
            <icon href="images/jogl_logo.jpg"/>
            <offline-allowed/>
      </information>
      <security>
            <all-permissions/>
      </security>
      <resources os="Windows">
            <j2se version="1.4+"/>
            <jar href="JOGLInstallWin.jar"/>
      </resources>
      <resources os="Linux">
            <j2se version="1.4+"/>
            <jar href="JOGLInstallLinux.jar"/>
      </resources>
      <resources os="Mac OS">
            <j2se version="1.4+"/>
            <jar href="JOGLInstallMac.jar"/>
      </resources>
      <installer-desc main-class="MainInstall"/>
</jnlp>

You bring up an interesting issue as I’m not sure its possible to recognize a specific version of the OS in WebStart for OSX. Sounds like an RFE for the Panther folks.