Error with webstart

Started by kobeto, September 12, 2004, 12:36:39 AM

Previous topic - Next topic

EgonOlsen

Here's how the current Paradroidz-jar is looking:

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://www.jpct.net/para3d2" href="test.jnlp">
<application-desc main-class="naroth.start.StartFrame"/>
<information>
<title>Paradroidz</title>
<vendor>jPCT - http://www.jpct.net</vendor>
<homepage href="http://www.jpct.net/paradroidz"/>
<description>Paradroidz -  a 3d remake of the C64 classic game</description>
<icon href="logo.jpg"/>
<icon kind="splash" href="splash.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4+" initial-heap-size="128m" max-heap-size="300m"/>
<jar href="Naroth.jar"/>
<jar href="lib/jpct.jar"/>
<jar href="lib/lwjgl.jar"/>
<jar href="lib/lwjgl_util.jar"/>
</resources>
<resources os="Windows">
<j2se version="1.4+"/>
<nativelib href="lib/lwjgl_win.jar"/>
<property name="java.library.path" value="." />
</resources>
<resources os="Linux" arch="i386">
<j2se version="1.4+"/>
<nativelib href="lib/lwjgl_linux.jar"/>
<property name="java.library.path" value="." />
</resources>
  <resources os="Mac OS X">
<j2se version="1.4+"/>
    <nativelib href="lib/lwjgl_osx.jar"/>
<property name="java.library.path" value="." />
  </resources>
</jnlp>



qjvictor

I did as you told.

But a strange thing happens.

In jdk1.5, it is fine, but in jdk1.4, still can't find the dll.

EgonOlsen

Try it without the

<property name="java.library.path" value="." />

thing for Java1.4. I remember that i had to add this for 1.5. Maybe it causes trouble with 1.4? I can't test it ATM, no Java 1.4 on this machine. But at work, i'm still using Java1.4 and my jnlp works fine there...well, you never know. Just give it a try.

qjvictor

after remove that line, it is still not working in jdk1.4

I am crazy about this issue.

EgonOlsen

How's the jnlp looking now?

qjvictor

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://......" href=".....jnlp">
<application-desc main-class="com.horse.HorseRunnerMain"/>
<information>
<title>...</title>
<vendor>...</vendor>
<homepage href="http://......"/>
<description>...</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.4+" initial-heap-size="128m" max-heap-size="300m"/>
<jar href="horseracing.jar" main="true"/>
</resources>
<resources os="Windows">
<j2se version="1.4+"/>
<nativelib href="lib/lwjgl_win.jar"/>
</resources>
</jnlp>

EgonOlsen

That's not what i suggested. Try to change this part:

<resources>
  <j2se version="1.4+" initial-heap-size="128m" max-heap-size="300m"/>
  <jar href="horseracing.jar" main="true"/>
</resources>
<resources os="Windows">
  <j2se version="1.4+"/>
  <nativelib href="lib/lwjgl_win.jar"/>
</resources>


to something like this:

<resources>
  <j2se version="1.4+" initial-heap-size="128m" max-heap-size="300m"/>
  <jar href="horseracing.jar" main="true"/>
  <jar href="lwjgl.jar"/>
</resources>
<resources os="Windows">
  <j2se version="1.4+"/>
  <nativelib href="lib/lwjgl_win.jar"/>
  <property name="java.library.path" value="." />
</resources>


Where lwjgl.jar is the plain and simple lwjgl.jar containing the java-parts of lwjgl and lwjgl_win.jar is a renamed .zip containing all the dlls needed.

qjvictor

already tried. doesn't work in jdk1.4, even remove the property line

  <resources>
     <j2se version="1.4+" initial-heap-size="128m" max-heap-size="300m"/>
     <jar href="horseracing.jar" main="true"/>
     <jar href="lib/lwjgl.jar"/>
     <jar href="lib/lwjgl_util.jar"/>
  </resources>
  <resources os="Windows">
     <j2se version="1.4+"/>
     <nativelib href="lib/lwjgl_win.jar"/>
     <property name="java.library.path" value="." />
  </resources>

EgonOlsen


qjvictor

Yes, it works.
what's the code of the transferring the dll to local machine?
following is my code:
String home="C:/ampm/player";
    try {
        String base=servletPath+"/client/player/";
        byte[] dll=new Transferer(base+"lwjgl.dll").transfer();
        File file=new File(home);
        file.mkdirs();
        file=new File(home+"/lwjgl.dll");
        OutputStream out=new FileOutputStream(file);
        out.write(dll,0,dll.length);
        out.close();
     } catch(Exception e) {
        e.printStackTrace();
     }

Should I use System.load or something else to load the dll?

The Paradroidz  will pass the dll to the client, right?

EgonOlsen

:?: There's no need to transfer the dll in your code when using webstart. Just put it in the native section of the jnlp and webstart will take care of it. Write your application as if there is no dll (i.e. it's just specified at startup via the library.path), don't try to copy the dll around manually.

qjvictor

ok, I will have a try.
tell you the result.

Could you give me a code slip which use java.library.path at the starting?

EgonOlsen

No code has be written for this. Just start your application with that parameter. For example, Paradroidz as an application starts like this:

java -Xmx256m -cp lib\jpct.jar;lib\lwjgl.jar;lib\lwjgl_util.jar;bin\Naroth.jar -Djava.library.path=lib naroth.start.StartFrame

All native parts (dlls for Windows, bins for Linux etc) are in that lib-directory. That's all. No code has to be written here. In webstart, just give the jar containing the native part for the underlying platform like the given jnlp already does and you are done.

EgonOlsen