Problems with creating distribuable java webstart application :(

Oki, without further ado here goes description of my problem:

I'm keeping main class and textures within projectjavaapplication14.jar and libraries in projectlib folder.

JNLP file (named "main.jnlp") looks like this:


<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
    codebase="file:///c:/Java/project"
    href="main.jnlp">

    <information>
        <title>Tryout</title>
        <vendor>Vendor</vendor>
        <homepage href="http://www.jmonkeyengine.com"/>
   
        <description>Dsc</description>
        <description kind="short">Short dsc.</description>
        <offline-allowed/>
    </information>

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

    <resources>
<j2se version="1.5+"/>
  <jar href="JavaApplication14.jar" main="true"/>
  <jar href="lib/lwjgl.jar"/>
  <jar href="lib/jme.jar"/>
    </resources>
  <application-desc main-class="JavaApplication.Main"/>
</jnlp>

This version did not work, I received message that JAR resources in JNLP file are not signed by same certificate (I've signed JavaApplication14.jar earlier)...
I thought for a moment, and signed lwjgl.jar and jme.jar too.. after running main.jnlp same error message popped up.

So I sat and concentrated for few minutes more and then a brilliant thought appared! "Hey how about jaring application14.jar and lib into one jar and then signing it.
Without hesitation I did it and now I have a little trouble.. how to edit jnlp file? How should links to resources inside .jar file look like? I tried "app.jarliblwjgl.jar", "appliblwjgl.jar", "app.lib.lwjgl.jar", and all I got from those are error messages about java not being able to find recourse files :(..

Help? >.< :?

Ps. Yeh I'm a noobie.

hope this helps



replace the resource branch as follws



<resources>
<j2se href="http://java.sun.com/products/autodl/j2se" version="1.6+"

i think the problem is that the lwjgl.jar comes presigned IIRC …



what i did was remove the existing signature in lwjgl.jar and sign all jars with the following ant file:

just put the ant file and all the jars with your keystore in a directory.



<project name="YourProject" default="signjars" basedir=".">
    <description>
        Ant Build File for YourProject webstart
    </description>
   <target name="signjars" description="sign all jars in this folder">
      <signjar jar="*.jar" alias="yourname" keystore="myKeystore" storepass="yourpass" />
   </target>
</project>

Thanks for help guys!

It was what Core suggested :slight_smile:

I have another trouble now but before I'll bother you all with it I'll try to solve by myself :slight_smile:



-cheers-



Edit:

Seems I'm stuck at this… what does it mean? How can I fix it?


Error: Unexpected exception: java.lang.reflect.InvocationTargetException"


"Caused by: java.lang.NoClassDefFoundError: com/jmex/awt/lwjgl/LWJGLCanvas"

Seems like you're missing the 'jme-awt.jar' file in the classpath…

Doh… might be it lol, thanks! I'll check it out as soon as I come back from uni.

ok i was fighting with webstart today once again, but now i am a little bit smarter and i want to share my knowledge :slight_smile: (before i forget it again…).


  • Avoiding the "JAR resources in JNLP file are not signed by same certificate" Error:

    If you want to use two different certificates, like your own and lwjgl, then you have to make two jnlp files:



    in the main .jnlp file … instead of

<resources>
  <jar href="lwjgl.jar"/>
</resources



you link to the other jnlp (lwjgl.jnlp):

<resources>
  <extension name="lwjgl" href="lwjgl.jnlp"/>
<resources/>



the lwjgl.jnlp where lwjgl.jar is located has to look like this:


<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+"
      codebase="http://www.yoursite.com/webstart"
      href="lwjgl.jnlp">

  <information>
    <title>lwjgl</title>
    <vendor>Vendor</vendor>
  </information>
  <component-desc/>

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

  <resources>
    <jar href="lwjgl.jar"/>
  <resources/>

</jnlp>



the <component-desc/> part is important.