Howto include and use native libs in webstart?

Started by Linuxhippy, November 04, 2004, 16:34:16

Previous topic - Next topic

Linuxhippy

Hi again!

I thought it would be a good idea to ask here because users here are experiecnced with packing native libraries into webstart-archives *g*

It would be really great if you could answer me the following questions:

1.) Is it possible to get with a self-signed  (java asks user) webstart enough permissions to load native libs?

2.) How do you tell webstart which dll or .so to use for which operating system, how can this be done in java-code?

Do you know a good tutorial about including native libraries with webstart?

Thanks in advance, lg Clemens

Orangy Tang

Quote from: "Linuxhippy"
1.) Is it possible to get with a self-signed  (java asks user) webstart enough permissions to load native libs?
Sure, you just need to request all permisions in your webstart script (and the user gets a slightly scary warning dialog, but thats just something we've got to live with).

Quote2.) How do you tell webstart which dll or .so to use for which operating system, how can this be done in java-code?
Each native file needs to be packed into a single jar each (and signed, natch). Then you include them in the webstart script with the nativelib tag.

Everything should be nicely explained here: http://www.cokeandcode.com/info/webstart-howto.html :D

cfmdobbie

Cas'll be along eventually to say exactly the same thing, so I may as well do it for him.  Here's the AlienFlux JNLP file; if you copy this structure and syntax as closely as you can, you'll likely not have any problems with deployment:

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

<!-- JNLP File for Alien Flux Alpha Test --> 
<jnlp 
  spec="1.0+" 
  codebase="http://www.puppygames.net/downloads/" 
  href="alienflux-full.jnlp"> 
  <information> 
    <title>Alien Flux 1.5d</title> 
    <vendor>Puppy Games</vendor> 
    <homepage href="http://www.puppygames.net/"/> 
    <description>Defend the cute Fluffies from the evil Bubbles.</description> 
    <description kind="short">Shoot-em-up</description> 
    <offline-allowed/> 
  </information> 
  <security> 
      <all-permissions/> 
  </security>
  <resources> 
    <j2se version="1.4+"/> 
    <jar href="alienflux-full-code.jar"/>
    <jar href="alienflux-full-sprites.jar"/>
    <jar href="alienflux-full-shadows.jar"/>
    <jar href="alienflux-full-sounds.jar"/>
    <jar href="alienflux-full-images.jar"/>
    <jar href="alienflux-full-fonts.jar"/>
    <jar href="alienflux-full-images.jar"/>
    <jar href="alienflux-full-game.jar"/>
    <jar href="lwjgl.jar"/>
    <jar href="spgl.jar"/>
    <extension href="bc.jnlp" />
  </resources> 
  <resources os="Windows">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-windows.jar"/>
    <nativelib href="openal-windows.jar"/>
  </resources>
  <resources os="MacOS">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-osx.jar"/>
    <nativelib href="openal-osx.jar"/>
  </resources> 
  <resources os="Linux" arch="i386">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-linux.jar"/>
    <nativelib href="openal-linux.jar"/>
  </resources> 
  <property key="java.library.path" value="." />
  <application-desc main-class="xap.Game"/> 
</jnlp>
ellomynameis Charlie Dobbie.

CaptainJester

Quote from: "cfmdobbie"
 <resources os="Windows">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-windows.jar"/>
    <nativelib href="openal-windows.jar"/>
  </resources>
  <resources os="MacOS">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-osx.jar"/>
    <nativelib href="openal-osx.jar"/>
  </resources> 
  <resources os="Linux" arch="i386">
    <j2se version="1.4+"/> 
    <nativelib href="lwjgl-linux.jar"/>
    <nativelib href="openal-linux.jar"/>
  </resources>

One note:  You don't have to pack each native lib into its own jar.  If you have a bunch of native libs you can pack them all into one jar if you want. (Don't know if this is recommended or not though.)
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

princec

I just do it that way to save a bit of bandwidth if I have to update one.

Cas :)