Can't get webstart to work

Hi all,



After trying and trying I've finally decided to ask for some help to get a JMonkey project to work in webstart. I've read all the guides I could find (webstart stepbystep and others), learned a lot, but still have problems :slight_smile:



Here is what I've done:


  • I followed the Netbeans tutorial to set JMonkey up in Netbeans (using JME and Physics Compile and Run libraries) - Using Netbeans now (instead of eclipse) because it handles all signing and creation of jnlp for you.
  • JMonkey works perfectly in Netbeans (when I run the project locally)



    Webstart problems:


  • When told my project to run in webstart it couldn't find my library jar-files, because it won't copy them: "Error: C:UsersufoDesktopJME2JME2build is a directory or can't be read. Not copying the libraries."


  • I solved this by copying the required jars manually in the dist/lib folder of my application (I also included all jars from the target folder)


  • When I run webstart with all the jars satisfied in the lib folder it finds and signs all the jars successfully, but then I get: "java.lang.NoClassDefFoundError: com/jme/app/SimpleGame" while webstart tries to launch the app. (using simplegame example post below)



    Hope someone can help me out here. Thanks in advance!



    PS. I'm from Holland, so excuse me for any bad sentences :slight_smile:


mcneoflash



Used Main.java

package jmetest;

import com.jme.app.SimpleGame;
import com.jme.bounding.BoundingBox;
import com.jme.bounding.BoundingSphere;
import com.jme.math.Vector3f;
import com.jme.scene.shape.Box;
import com.jme.scene.shape.Sphere;

public class Main extends SimpleGame {

   public static void main(String[] args) {

      Main main = new Main();
      main.setConfigShowMode(ConfigShowMode.ShowIfNoConfig);
      main.start();
   }

   protected void simpleInitGame() {
      Box box1 = new Box("Box numero uno", new Vector3f(0,1,0),1,1,1);
      box1.setModelBound(new BoundingBox());
      box1.updateModelBound();
      rootNode.attachChild(box1);
      Box box2 = new Box("Box numero dos", new Vector3f(0,-1,0),10,0.25f,10);
      box2.setModelBound(new BoundingBox());
      box2.updateModelBound();
      rootNode.attachChild(box2);
      Sphere sphere1 = new Sphere("Sphere nummer eins", new Vector3f(0,1,1), 20, 20, 1);
      sphere1.setModelBound(new BoundingSphere());
      sphere1.updateModelBound();
      rootNode.attachChild(sphere1);
      rootNode.setModelBound(new BoundingBox());
      rootNode.updateModelBound();
   }
}


used webstart (generated by Netbeans):


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="file:/C:/Users/ufo/Desktop/Projects/JMETest/dist/" href="launch.jnlp" spec="1.0+">
    <information>
        <title>JMETest</title>
        <vendor>ufo</vendor>
        <homepage href=""/>
        <description>JMETest</description>
        <description kind="short">JMETest</description>


    <offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
    <resources>
<j2se java-vm-args="-Djava.library.path=&quot;C:usersufoDesktopjME2jME2liblwjglnativewin32&quot;;&quot;c:usersufoDesktopjME2jME2lib&quot;" version="1.5+"/>
<jar eager="true" href="JMETest.jar" main="true"/>


    <jar href="lib/jME2Physics.jar"/>
<jar href="lib/gluegen-rt.jar"/>
<jar href="lib/jogl.jar"/>
<jar href="lib/jorbis-0.0.17.jar"/>
<jar href="lib/junit-4.1.jar"/>
<jar href="lib/jinput.jar"/>
<jar href="lib/lwjgl.jar"/>
<jar href="lib/lwjgl_util.jar"/>
<jar href="lib/lwjgl_util_applet.jar"/>
<jar href="lib/swt.jar"/>
<jar href="lib/odejava-jni.jar"/>
</resources>
    <application-desc main-class="jmetest.Main">

    </application-desc>
</jnlp>



edit: added [ code ] tags

Your webstart refers to a local drive (C:) so that can't possibly work.


  1. you need to create the jme jar files (jme's build.xml)
  2. create a jar from your application. (export your class with netbeans)
  3. create jars for the native libraries (see wiki entry)
  4. sign everything
  5. create the jnlp file



    I made myself a php/gwt script which does pretty much that, so i can generate a webstart from a simple Executable class like yours on the fly :).

    Heres your webstart link: http://www.core-dump.ch/gwt/appl_jar/Main.jnlp



    My generated jnlp file:


<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
codebase="http://www.core-dump.ch/gwt"
href="appl_jar/Main.jnlp">
<information>
    <title>TITLE</title>
    <vendor>VENDOR</vendor>
    <homepage href="www.coredump.ch"/>
    <description>DESCRIPTION</description>
    <description kind="short">SHORT_DESCRIPTION</description>
    <offline-allowed/>
  </information>
  <security>
      <all-permissions/>
  </security>
  <resources>
    <jar href="appl_jar/Main.jar"/>
    <jar href="jme_jars/lwjgl.jar" />
    <jar href="jme_jars/lwjgl_util.jar" />
    <jar href="jme_jars/jinput.jar" />
    <jar href="jme_jars/jorbis-0.0.17.jar" />
    <jar href="jme_jars/jme.jar" />
    <jar href="jme_jars/jme-font.jar" />
    <jar href="jme_jars/jme-scene.jar" />
    <jar href="jme_jars/jmetest.jar" />
    <jar href="jme_jars/jmetest-data-cursor.jar" />
    <jar href="jme_jars/jmetest-data-texture.jar" />
  </resources>
  <resources os="Windows">
     <j2se version="1.5+"/>
    <nativelib href="jme_jars/openal-windows.jar"/>
    <nativelib href="jme_jars/jinput-windows.jar"/>
    <nativelib href="jme_jars/lwjgl-windows.jar"/>
  </resources>
  <resources os="Mac OS">
   <j2se version="1.5+"/>
    <nativelib href="jme_jars/openal-mac.jar"/>
    <nativelib href="jme_jars/jinput-mac.jar"/>
    <nativelib href="jme_jars/lwjgl-mac.jar"/>
  </resources>
  <resources os="Linux" arch="i386">
    <j2se version="1.5+"/>
    <nativelib href="jme_jars/openal-linux.jar"/>
    <nativelib href="jme_jars/jinput-linux.jar"/>
    <nativelib href="jme_jars/lwjgl-linux.jar"/>
  </resources>
 <application-desc main-class="Main"/>
</jnlp>

I am unable to get webstart to work as well.  I have set things up according to the wiki.



All of the jar files are signed.  I have created a separate jar per OS for natives.


Apr 22, 2009 11:40:00 PM com.jmex.game.DefaultUncaughtExceptionHandler uncaughtException
SEVERE: Main game loop broken by uncaught exception
java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at org.lwjgl.Sys$1.run(Sys.java:72)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.lwjgl.Sys.doLoadLibrary(Sys.java:65)
        at org.lwjgl.Sys.loadLibrary(Sys.java:81)
        at org.lwjgl.Sys.&lt;clinit&gt;(Sys.java:98)
        at org.lwjgl.opengl.Display.&lt;clinit&gt;(Display.java:129)
        at com.jme.system.lwjgl.LWJGLDisplaySystem.setTitle(LWJGLDisplaySystem.java:117)
        at com.jmex.game.StandardGame.initSystem(StandardGame.java:290)
        at com.jmex.game.StandardGame.run(StandardGame.java:210)
        at java.lang.Thread.run(Thread.java:619)



I use 2 jnlp files.  1 for the main and one for 3rd party libs.

Here is the relevent section of the JNLP that contains the native jars.


    <!--native libs -->
    <resource os="Linux">
        <nativelib href="lib/native/linux.jar"/>
    </resource>
    <resource os="Mac OS X">
        <nativelib href="lib/native/mac.jar"/>
    </resource>
    <resource os="Windows">
        <nativelib href="lib/native/win.jar"/>
    </resource>



This is whats inside the linux.jar


unzip -l lib/native/linux.jar
Archive:  lib/native/linux.jar
  Length     Date   Time    Name
 


    ----   ----    ----
      642  04-22-09 22:22   META-INF/MANIFEST.MF
      732  04-22-09 22:22   META-INF/MONKY.SF
     1090  04-22-09 22:22   META-INF/MONKY.DSA
        0  04-22-09 22:21   META-INF/
    10604  04-08-09 12:46   libjinput-linux.so
    13776  04-08-09 12:46   libjinput-linux64.so
   277580  04-08-09 12:46   liblwjgl.so
   346360  04-08-09 12:46   liblwjgl64.so
   864020  04-08-09 12:46   libodejava.so
   928960  04-08-09 12:46   libodejava64.so
   158152  04-08-09 12:46   libopenal.so
   177410  04-08-09 12:46   libopenal64.so
 
                  
  2779326                   12 files



Any idea whats going wrong (I'm using the Linux version right now)?

Thanks

My JNLP file looks like this:


<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://download.tuxfamily.org/tuer/" href="tuer.jnlp">
  <information>
    <title>TUER</title>
    <vendor>Julien GOUESSE</vendor>
    <homepage href="http://tuer.tuxfamily.org"/>
    <description>Small Quake-like written in Java + JOGL</description>
    <description kind="short">kill them all!!</description>
    <icon href="tuerLogo.png"/>
    <icon kind="splash" href="tuerLogo.png"/>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions />
  </security>
  <update check="always" policy="always"/>
  <property name="sun.java2d.noddraw" value="true"/>
  <resources>
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="32m" max-heap-size="256m"/> 
    <extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-1.1.1/webstart/jogl.jnlp" />
    <jar href="tuer.jar" download="eager" main="true"/>
    <jar href="jme.jar" download="eager" main="false"/>
    <jar href="jme-audio.jar" download="eager" main="false"/>
    <jar href="jme-awt.jar" download="eager" main="false"/>
    <jar href="jme-font.jar" download="eager" main="false"/>
    <jar href="jme-gamestates.jar" download="eager" main="false"/>
    <jar href="jme-model.jar" download="eager" main="false"/>
    <jar href="jme-scene.jar" download="eager" main="false"/>
    <jar href="jme-xml.jar" download="eager" main="false"/>
  </resources>
  <application-desc main-class="jme.JMEGameServiceProvider" />
  <component-desc/>
</jnlp>


It is perhaps not the standard way of deploying a game that uses JMonkeyEngine 2.0 but it works :D

i dont see a 'arch' property in your jnlp file:

<resources os="Linux" arch="i386">



i'm not sure if its needed but it cant hurt i guess.

Well I decided for my own Game, that the Webstart Application is only a Downlaoder, and downloads/updates all files, then start the game.

The arch doesn't make a difference (I still get the error with it).



Also, gouessej you are using jogl where I am using lwjgl.  So you are using a jws that is provided by the jogl team right?  Is there something like this for lwjgl?  If so, then that would probably solve my problem.



In the mean time, here are my jnlp files.



mo.jnlp (main jnlp file)


<?xml version="1.0" encoding="utf-8"?>
<!-- Massive Online Client -->
<jnlp
    spec="6.0+"
    codebase="http://monky-games.com/mo_client"
    href="mo.jnlp">
    <information>
        <title>Massive Online</title>
        <vendor>Monkey Games</vendor>
        <homepage href="http://monky-games.com/"/>
        <description>Launches Massive Online Client</description>
        <description kind="short">MO Launcher</description>
        <shortcut>
            <desktop/>
            <menu submenu="Massive Online"/>
        </shortcut>
        <related-content href="http://www.monky-games.com">
            <title>Massive Online</title>
        </related-content>
    </information>
    <security>
        <all-permissions/>
    </security>
    <update check="always" policy="true"/>
    <resources>
        <j2se href="http://java.sun.com/products/autodl/j2se"
              version="1.6+"initial-heap-size="500M" max-heap-size="1000M"/>
        <jar href="lib/mo_client.jar"/>
        <extension name="MOLibs" href="http://monky-games.com/mo_client/mo_libs.jnlp"/>
    </resources>
    <application-desc main-class="mo_client.gui.Main"/>
</jnlp>



mo_libs.jnlp (the 3rd party libs file)


<?xml version="1.0" encoding="utf-8"?>
<jnlp
    spec="6.0+"
    codebase="http://monky-games.com/mo_client"
    href="mo_libs.jnlp">
    <information>
        <title>MOLibs</title>
        <vendor>Monkey Games</vendor>
        <homepage href="http://monky-games.com/"/>
        <description>Massive Online libs</description>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources>
        <jar href="lib/mo_data.jar"/>
        <!-- 3rd Party Libs -->
        <!-- gfx -->
        <jar href="lib/gfx/FengGUI.jar"/>
        <jar href="lib/gfx/miglayout-3.6.jar"/>
        <!-- jme -->
        <jar href="lib/jme/jme-audio.jar"/>
        <jar href="lib/jme/jme-awt.jar"/>
        <jar href="lib/jme/jme-collada.jar"/>
        <jar href="lib/jme/jme-editors.jar"/>
        <jar href="lib/jme/jme-effects.jar"/>
        <jar href="lib/jme/jme-font.jar"/>
        <jar href="lib/jme/jme-gamestates.jar"/>
        <jar href="lib/jme/jme.jar"/>
        <jar href="lib/jme/jme-model.jar"/>
        <jar href="lib/jme/jme-scene.jar"/>
        <jar href="lib/jme/jme-swt.jar"/>
       <jar href="lib/jme/jme-terrain.jar"/>
        <jar href="lib/jme/jme-xml.jar"/>
        <!-- jphys -->
        <jar href="lib/jphys/jme-physics.jar"/>
        <!-- loaders -->
        <jar href="lib/loaders/jme_q3.jar"/>
        <jar href="lib/loaders/md5importer.jar"/>
        <!-- lwjgl -->
        <jar href="lib/lwjgl/lwjgl.jar"/>
        <jar href="lib/lwjgl/lwjgl_util_applet.jar"/>
        <jar href="lib/lwjgl/lwjgl_util.jar"/>
    </resources>
    <!--native libs -->
    <resource os="Linux">
        <nativelib href="lib/native/linux.jar"/>
    </resource>
    <resource os="Mac OS X">
        <nativelib href="lib/native/mac.jar"/>
    </resource>
    <resource os="Windows">
        <nativelib href="lib/native/win.jar"/>
    </resource>
    <component-desc />
</jnlp>

Conzar said:

The arch doesn't make a difference (I still get the error with it).

Also, gouessej you are using jogl where I am using lwjgl.  So you are using a jws that is provided by the jogl team right?  Is there something like this for lwjgl?  If so, then that would probably solve my problem.

This should work:

<extension name="lwjgl" href="http://lwjgl.org/jnlp/extension.php" />


I'm watching your JNLP file right now. I'm at work so I can't try it.

Thanks gouessej!!!  Do you happen to know which version this is?  I couldn't find the link on the lwjgl.org web site.



I am also at work and can't try it out until tonight too :slight_smile:



Update:

Arg, I think I know what the problem is!!!

    <!--native libs -->
    <resource os="Linux">
        <nativelib href="lib/native/linux.jar"/>
    </resource>
    <resource os="Mac OS X">
        <nativelib href="lib/native/mac.jar"/>
    </resource>
    <resource os="Windows">
        <nativelib href="lib/native/win.jar"/>
    </resource>



Anyone see anything wrong with the element names?
I do, it should be <resources> not <resource> ... Right?
Conzar said:

Thanks gouessej!!!  Do you happen to know which version this is?  I couldn't find the link on the lwjgl.org web site.

This is the latest one, 2.1.0. When you use it as a link, it should display a white page but launch Java Webstart and load jinput.jar, lwjgl_util.jar, lwjgl.jar and native_linux.jar (if you're under Linux); this is the solution then what is wrong with this???