Webstart fails to find the lib's :(

Hi, I am using netbeans to deploy my webstart app, and while it works fine when runned like normal applications, when I try to run it like Web Start I get this.


java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.sun.javaws.Launcher.executeApplication(Unknown Source)
	at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
	at java.lang.ClassLoader.loadLibrary(Unknown Source)
	at java.lang.Runtime.loadLibrary0(Unknown Source)
	at java.lang.System.loadLibrary(Unknown Source)
	at org.lwjgl.Sys$1.run(Sys.java:75)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.lwjgl.Sys.doLoadLibrary(Sys.java:68)
	at org.lwjgl.Sys.loadLibrary(Sys.java:84)
	at org.lwjgl.Sys.<clinit>(Sys.java:101)
	at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
	at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
	at moonlander.TheGame.main(TheGame.java:231)
	... 9 more

I put the -Djava.library.path=\lib as VM arguments.

Please help.

Let us see your jnlp file and we may be able to help more

Sure, here you go, it is netbeans generated

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jnlp codebase="http://89.164.146.196/webstart" href="launch.jnlp" spec="1.0+">
    <information>
        <title>MoonLander</title>
        <vendor>Systat</vendor>
        <homepage href=""/>
        <description>The MoonLander ofcourse</description>
        <description kind="short">MoonLander</description>


    <offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
    <resources>
<j2se java-vm-args="-Djava.library.path=\lib" version="1.5+"/>
<jar eager="true" href="MoonLander.jar" main="true"/>


    <jar href="lib/hiero.jar"/>
<jar href="lib/ibxm.jar"/>
<jar href="lib/jinput.jar"/>
<jar href="lib/jnlp.jar"/>
<jar href="lib/jogg-0.0.7.jar"/>
<jar href="lib/jorbis-0.0.15.jar"/>
<jar href="lib/lwjgl.jar"/>
<jar href="lib/natives-linux.jar"/>
<jar href="lib/natives-mac.jar"/>
<jar href="lib/natives-win32.jar"/>
<jar href="lib/packulike.jar"/>
<jar href="lib/pedigree.jar"/>
<jar href="lib/scalar.jar"/>
<jar href="lib/slick-examples.jar"/>
<jar href="lib/slick-util.jar"/>
<jar href="lib/slick.jar"/>
<jar href="lib/tinylinepp.jar"/>
</resources>
    <application-desc main-class="moonlander.TheGame">

    </application-desc>
</jnlp>

Using natives in Webstart does not work by setting “-Djava.library.path”. Take a look add the JNLPs for lauchning the demos http://www.lwjgl.org/demos.php. They use the extension mechanism to link to the LWJGL libraries on the lwjgl homepage.


<!-- JNLP File for LWJGL Demos --> 
<jnlp 
  spec="1.0+" 
  codebase="http://lwjgl.org/jnlp/" 
  href="lwjgl-demo.php/test.input.TestControllers"> 
  <information> 
    <title>LWJGL Demo [test.input.TestControllers]</title> 
    <vendor>LWJGL</vendor> 
    <homepage href="http://lwjgl.org/"/> 
    <description>Demonstration of LWJGL</description> 
    <description kind="short">Technology Preview</description> 
    <icon kind="splash" href="logo.png" />
    <offline-allowed/> 
  </information> 
  <resources> 
    <j2se version="1.4+"/> 
		<jar href="lwjgl_test.jar"/>
    <jar href="media.jar"/>
    <extension name="lwjgl" href="http://lwjgl.org/jnlp/extension.php" />
  </resources> 
  <application-desc main-class="org.lwjgl.test.input.TestControllers">
    </application-desc>
</jnlp>

If you don’t want to link to it, you have to add per platform resources to the jnlp files like in the extension descriptor:


<!-- JNLP Extension File --> 
<jnlp 
  spec="1.0+" 
  codebase="http://lwjgl.org/jnlp/" 
  href="extension.php"> 
  <information> 
    <title>LWJGL</title> 
    <vendor>LWJGL</vendor> 
    <homepage href="http://lwjgl.org/"/> 
    <description>LWJGL webstart extension</description> 
    <description kind="short">LWJGL webstart extension</description> 
    <icon kind="splash" href="logo.png" />
    <offline-allowed/> 
  </information> 
  <security> 
      <all-permissions/> 
  </security>
  <resources> 
    <j2se version="1.4+"/> 
    <jar href="lwjgl.jar"/>
    <jar href="lwjgl_util.jar"/>
    <jar href="jinput.jar"/>
  </resources> 
  <resources os="Windows">
    <j2se version="1.4+"/> 
    <nativelib href="native_win32.jar"/>
  </resources> 
  <resources os="Linux">
    <j2se version="1.4+"/> 
    <nativelib href="native_linux.jar"/>
  </resources>   
  <resources os="Mac OS X">
    <j2se version="1.4+"/> 
    <nativelib href="native_macosx.jar"/>
  </resources>
  <resources os="SunOS" arch="x86">
    <j2se version="1.4+"/> 
    <nativelib href="native_solaris.jar"/>
  </resources>  
  
  <component-desc />
</jnlp>

I managed to get it to work, but when I try to run jnlp from other computer it keeps crying that resource C:\sbkaojbakbo\Documents and Setting\myresource\someimage.png can’t be found :’(

You are probably trying to load an image from a file on disk. That does not work with webstart. You have to put your resources in jars and use the this.getClass().getClasloader().getResourceAsStream("/path/to/your/resource/in/a/jar") to load it.

No, I use SLICK, I don’t need to use that, anyway, I managed to run it on my DESKTOP computer(the server is runing on my laptop), and one of my friends managed to run webstart, but one, got this error.

java.lang.ClassNotFoundException: TheGame
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
	at com.sun.javaws.Launcher.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

I don’t have slightest idea what is causing it.

Maybe try getting him to clear his webstart cache and re-try. Webstart is usually more bullet-proof than what you’re experiencing. But sometimes when you start off with a faulty jnlp or jars they can stick around in the cache and stuff up the program later.