hunter99
hunter99

Reputation: 359

jws application can't load swing-layout

I have an old application that use swing-layout and i have to make it usable via java webstart . It runs fine from netbeans but if I launch it using jws I got this error :

exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group
    at Gui.Accueil.jMenuItemConsPHActionPerformed(Accueil.java:2331)
.....
Caused by: java.lang.ClassNotFoundException: org.jdesktop.layout.GroupLayout$Group
    at java.net.URLClassLoader$1.run(Unknown Source)
    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)
    ... 41 more

I have tried to add swing-layout in the jnlp file but I get this error when I run it :

com.sun.deploy.net.FailedDownloadException: Impossible de charger la ressource : http://my_url:8080/___JWSappclient/___app/test/lib/swing-layout-1.0.4.jar

this the jnlp :

<jnlp spec="1.0+" codebase="" href="">

    <information>
        <title>test </title>
           </information>
    <eligible>True</eligible>
    <security>
        <all-permissions/>
    </security>
    <resources>

        <jar href="./lib/swing-layout-1.0.4.jar"/> 
    </resources>

</jnlp>

Thanks .

First edit :

I have removed and tried with many path but it's almost the same error com.sun.deploy.net.FailedDownloadException: Impossible de charger la ressource : http://url/___JWSappclient/___app/test/lib/swing-layout-1.0.4.jar

I tried to change swing-layout name to sl.jar but it didn't help . What I dont understand is why jws try to download the swing-layout.jar from the server ?

Upvotes: 0

Views: 3165

Answers (1)

trashgod
trashgod

Reputation: 205775

The element <eligible> does not appear in the JNLP File Syntax, and your file is malformed as shown. In your previous question on this topic, you mentioned needing to support Java 6. To support Java 5, specify it in <resources>. The JAR containing org.jdesktop.layout.GroupLayout appears correct, but the path is suspicious. Try something like this:

<resources>
    <j2se version="1.5+" />
    <jar href="lib/swing-layout-1.0.4.jar"/>
</resources>

Addendum: I don't understand why JWS tries to download the swing-layout.jar from the server.

The JNLP client downloads all JARs from the server via HTTP. Each JAR must be accessible using the relative path specified in the href attribute. In particular, the directory containing your application JAR and JNLP file must also have a lib directory containing the layout JAR.

test/
    application.jnlp
    application.jar
    lib/
        swing-layout-1.0.4.jar

Upvotes: 2

Related Questions