JOGL Java Plug-In Extension?

So it occurs to me that there are a lot of cool things that could be done with JOGL in an applet. In fact, I think it’d probably be quite popular. It seems to work well if you have JOGL pre-installed, but of course that’s an issue.

Anyway, I noticed on the board people previously pointing to the JOGL webstart info available here, but has anyone made an extension that can be installed by the Java Plug In? Certainly it must be possible.

I figured I’d try before asking; so as an experiment, I made a small applet that would decompress the appropriate native library to a random file (via File.createTempFile()) and System.load it. (I don’t think we can the user has write access to java.home/lib/ext or whatever). In Windows, this throws an UnsatisfiedLinkError with a message about not being able to load dependent libraries; although interestingly it does work in Mac OS X.

I have the same question – has anyone found a way to ensure JOGL is installed prior to an applet launching?

  • Greg Hassett

IIRC you can check to see if you can load the libraries. It has come up before in the forum but I can’t remember where…

I can certainly test, within the Java applet, whether JOGL is present or not. The problem is that I want to ensure that it is present PRIOR to the applet starting.

The Java Plug-In from Sun is (on Windows) an ActiveX control which basically ensures that a specified JRE is present (and downloads/installs it if iti’s not) before launching your applet.

The Java Plug-In can be extended to install “extensions” – but these are in the form of jar files (with accompanying manifests) which the Plug-In installs in the jre/lib/ext directory. I need a way to get the JOGL native files (DLL’s on Windows) into the jre/bin directory prior to launching the applet.

There is another problem with the “test for the libraries inside the applet” solution – what do I do if the libraries aren’t present? Within the Java Applet Sandbox, there is no way that I could copy the native (DLL) files into the client’s JRE – and even if I could do THAT, I would need to shut down and restart the JVM.

So really the only option is to ensure that the JOGL files are installed properly (native DLL’s in jre/bin and jogl.jar in jre/lib/ext) before my applet starts.

Has anyone found a way to do this? I was thinking of writing an ActiveX control which first instantiates the Java Plug-In, and first directs the Java Plug-In to do its thing (installing the JRE if necessary). Then my ActiveX control would check for JOGL installation, and put the files where they belong if necessary.

I would need to learn how to interact with the Java Plug-In (in the same way that the browser interacts with it) but since the browser-to-plug-in interface is documented, I suppose that I could instatiate the Java Plug-In (within my own ActiveX control) and simulate the browser telling it to do its thing. These seems like a lot of work, and also seems error-prone to me.

So I’m still looking for a clean, tested solution, if one exists.

  • Greg

According to this: http://java.sun.com/products/plugin/1.3/docs/extensions.html

You could provide a “Native Extension” that would run a small install program that copies the appropriate files into the lib/ext.

Kev