Packaging JOGL for webstart

So I’m struggling through webstart and packaging things up (hoping to have a decent demo for the contest), and I’m not entirely sure about how to handle the native files for mac, linux, solaris… do I just jar the .so files for linux (and does the solaris version just use the linux .so lib, they used the same name but I didn’t check size). Is there some ready jar’ed jogl natives already out and about somewhere easy already that I can just download and sign without having to jar them (I’m using the 1.0 jogl because at least a few situations that it worked as expected and the 1.1 versions didn’t). If there isn’t a handy couple of jar files somewhere I can sign can someone confirm that I just need to jar the .so files (and whatever the mac one was called)?

You can insert the following line into the resources section of your jnlp-file:

Then JoGL is automatically downloaded from java.net, no worries about platform, no packaging and signing :slight_smile: .

Hey… now that’s nifty… I have issues with some of the newer jogl binaries so I’m not sure I want to take that route. I’m kind of surprised that would work, though I guess seeing as any webstart app with jogl is going to need full permissions anyway it makes sense.

I did get the native jar files to work (at least for windows and mac they are tested), all I did was put the .dll, .so, .jnilp(sp?) files into their own jar’s and signed them.

Right, you have to put the native files into separate jars and sign them. The following lines show how to integrate the files into WebStart. Then the specific jar with the native files is used.


<resources os="Windows">
  <nativelib href="jogl-native-win32.jar"/>    
</resources>
<resources os="Linux">
  <nativelib href="jogl-native-linux.jar"/>
</resources>
<resources os="Mac OS">
  <nativelib href="jogl-native-macos.jar"/>
</resources>

Hope that helps.

Decided to give this a try hoping to avoid having to package up the latest jogl stuff… and well, it wouldn’t allow it, comlained about some jars not being signed by the same source. Anyone been able to make this work?

Extract the files from the current jars and make new jars. Then sign those with your signature. Works like a charm. Note that you must use the same signature for the app as well as the resource jars.

Kevin Glass has a pretty good doc on using webstart. Take a look here.

I’ve found this to work fine.

Just to clarify my previous post was in an attempt to get the line

to work instead of packaging up jogl myself (which I had done before and most likely I’ll be doing again).

Hi

I’m having some difficulties to make webstart work with a game using cg-Shaders. Native libraries cg.dll and cgGL.dll (or eqvivalent for other OS) are needed for the game.

When not using webstart these must be in windows/system32 or in the same path from which the game is running. I’ve tried to put them in another folder to which java.library.path points to with no luck. For some reason they seem to have to be in the base folder of the game. In a non-webstart release this isn’t such a big deal, but when using webstart it is a big problem.

I’ve put the files in .jar archive, signed it and put the following in the jnlp file.

<nativelib href = "lib/cg-natives-win32.jar"/>

But the game can not find the files, probably beacuse of the same reason as it doen’t work to put these files in the java.library.path when running the game from the command-line. I can manually put the files in windows/system32 folder to get the game working, but that is not a solution for a public release.

Has anybody else experience this problem? Any solutions?

/Khashayar

It might be easier if we can look at your jnlp file, from what I can see now the only clue I can give is to make sure that the lib directory exists and that is where you put your native jar. I also can’t see if you have the resources tag setup with the right os. Maybe the specific error webstart gives you (webstart is pretty finicky sometimes… especially with 1.5 beta).

The application starts without a problem. I click my way throgh the menus starting a game server and a client. The client starts loading the level and then I get the following error.

http://www.agency9.se/images/misc/mcowserror.gif

Webstart works out fine, but the application is unable to find the .dll file. I get the same error when I run the application from the command line without having cg.dll and cgGL.dll in the root-path of the application or in windows/system32 folder.

Have anyone tried (suceeded) to launch an application using cg-environment (cg.dll and cgGL.dll) with webstart?

Here’s the jnlp file.


<?xml version="1.0" encoding="utf-8"?>

<jnlp spec="1.0+" 
    codebase="http://www.agency9.se/ws/"
    href="mco.jnlp">

  <information>
    <title>MEGACORPS ONLINE</title>
    <vendor> Agency 9 AB </vendor>
    <homepage href="http://www.megacorpsonline.se/"/>
    <description>MEGACORPS ONLINE</description>
    <description kind="short">Tactical multiplayer first person shooter.</description>
    <icon href="icon.jpg"/>
    <offline-allowed/>
  </information>

  <security>
    <all-permissions/>
  </security>

  <resources>
    <j2se version="1.4.2+" initial-heap-size="200m" max-heap-size="512M" href="http://java.sun.com/products/autodl/j2se"/>
    <jar href="mco.jar" main="true"/>
    <jar href="data.jar"/>
    <jar href="lib/jinput.jar"/>
    <jar href="lib/jutils.jar"/>
    <jar href="lib/mysql-connector-java-2.0.14-bin.jar"/>
    <extension href="https://jogl.dev.java.net/webstart/jogl.jnlp" name="jogl"/>
  </resources>

  <resources os="Windows">
    <jar href = "lib/dxinput-win32.jar"/>
    <nativelib href = "lib/dxinput-natives-win32.jar"/>
    <nativelib href = "lib/cg-natives-win32.jar"/>
    <property name="jinput.plugins" value="net.java.games.input.DirectInputEnvironmentPlugin" /> 
  </resources>

  <resources os="Linux">
    <jar href = "lib/jinput-linux.jar"/>
    <property name="jinput.plugins" value="net.java.games.input.LinuxEnvironmentPlugin" /> 
    <nativelib href = "lib/jinput-natives-linux.jar"/>
  </resources>

  <resources os="Mac OS">
    <property name="jinput.plugins" value="net.java.games.input.OSXEnvironmentPlugin" /> 
  </resources>

  <resources os="Linux">
    <jar href = "lib/jinput-linux.jar"/>
    <property name="jinput.plugins" value="net.java.games.input.LinuxEnvironmentPlugin" />     <nativelib href = "lib/jinput-natives-linux.jar"/>
  </resources>

  <application-desc main-class="com.agency9.megacorps2.clientgui.A9MC2ClientMain"/>

</jnlp>

It probably won’t help with the problem but I don’t think you can get away with using the extension line, seems like webstart should complain about multiple certs being used, and if your jogl.jar doesn’t match the dll files a lot of weird problems happen.

Make sure that the cgGL.dll file was not renamed to all lower case or something similar to that is going wrong. Maybe try moving the native jars into the same folder as the rest of the jar files for your game /ws/ just to test it.

I’m assuming that the files are in the lib folder and you’ve double checked to make sure that the cgGL.dll file is actually in the jar and that the manifest file has it listed with a string of junk for the cert (and if the problem was one of these last two, you should claim that a virus was interfering with your java install and deny that the incident ever happened).

Hopefully this helps but otherwise I don’t really see anything else, getting webstart to work is pretty frustrating. I could look a little closer if you sent me some kind of authorization dealy so I could view the files myself (sometimes easier to spot stuff that way) though I’m not sure it’d help much.

Thanks, but I’ve had already tested all the suggestions you made.

However the problem is now solved and here’s the problem description and solution…

The problem is that it isn’t Java VM that directly calls on cg.dll or cgGL.dll. It is a native library (jogl.dll) that calls on them. When one native library calls on another native library the search isn’t conducted in the java.library.path but in the system path of the OS (i.e. ./ and windows/system32)

That is why it doesn’t work to put those dll:s in the java.library.path when executing the application form the command line. They have to be either in ./ (where the application is run) or in windows/system32 . That’s also the reason that webstart cannot locate those dlls even if they are jar-ed, signed and given as native libraries in the jnlp file.

Solution is rather simple. Load the dll files that are needed in your application.

System.loadLibrary("cg");
System.loadLibrary("cgGL");

This way they are allready loaded in the memory when jogl.dll wants to find them.

Another solution would be to try to somehow install those files in the system path, but that is probably not a better solution, since system path can differ on different systems (even if it is the same OS).

By the way the extension with jogl works out find, even if they are signed with different keys. But when you release something to public release you probably want to ship a version that you’ve tested and are certain that it works with your application.

Good to know how you solved it. I’m curious but did you try putting the cg.dll file and cgGL.dll file in the same file as jogl.dll? I’m curious if that would have worked or not (you probably already tried this too but still worth asking).

As long as you load both dll from inside the application with System.loadLibrary() it works if you put it inside the jogl.jar or any other jar.
Whithout the loading from the application it didn’t work even if it was inside the jogl.jar package.

However. I figured it’s better to have many small jars instead of few larger ones. This way the users don’t have to download large files when only some part of the application is updated.

Thanks for investigating this and finding a solution. Would you file a bug with the JOGL Issue Tracker describing the problem and solution? JOGL’s Cg support is still pretty experimental but we’d like to make it more robust.