jws 应用程序无法加载摆动布局 [英] jws application can't load swing-layout

查看:23
本文介绍了jws 应用程序无法加载摆动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 swing-layout 的旧应用程序,我必须通过 java webstart 使其可用.它在 netbeans 上运行良好,但如果我使用 jws 启动它,则会出现此错误:

线程AWT-EventQueue-0"中的异常 java.lang.NoClassDefFoundError: org/jdesktop/layout/GroupLayout$Group在 Gui.Accueil.jMenuItemConsPHActionPerformed(Accueil.java:2331).....引起:java.lang.ClassNotFoundException:org.jdesktop.layout.GroupLayout$Group在 java.net.URLClassLoader$1.run(Unknown Source)在 java.net.URLClassLoader$1.run(Unknown Source)在 java.security.AccessController.doPrivileged(Native Method)在 java.net.URLClassLoader.findClass(Unknown Source)在 com.sun.jnlp.JNLPClassLoader.findClass(来源不明)在 java.lang.ClassLoader.loadClass(来源不明)在 java.lang.ClassLoader.loadClass(来源不明)……还有 41 个

我曾尝试在 jnlp 文件中添加 Swing-layout,但在运行时出现此错误:

com.sun.deploy.net.FailedDownloadException:不可能从资源中取出充电器:http://my_url:8080/___JWSappclient/___app/test/lib/swing-layout-1.0.4.jar

这是 jnlp :

<信息><title>测试</title></信息><合格>真</合格><安全><所有权限/></安全><资源><jar href="./lib/swing-layout-1.0.4.jar"/></资源></jnlp>

谢谢.

第一次

我已经删除并尝试了许多路径,但它几乎是相同的错误 com.sun.deploy.net.FailedDownloadException: Impossible de Charger la ressource:http://url/___JWSappclient/___app/test/lib/Swing-layout-1.0.4.jar

我尝试将 swing-layout 名称更改为 sl.jar 但它没有帮助.我不明白的是为什么 jws 试图从服务器下载swing-layout.jar?

解决方案

元素没有出现在 JNLP 文件语法,并且您的文件格式错误,如图所示.在您关于此主题的上一个问题中,您提到需要支持 Java 6.要支持 Java 5,请在 <资源>.包含 org.jdesktop.layout.GroupLayout 的 JAR 看起来正确,但路径可疑.尝试这样的事情:

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

附录:我不明白为什么 JWS 试图从服务器下载 swing-layout.jar .

JNLP 客户端通过 HTTP 从服务器下载所有 JAR.每个 JAR 都必须可以使用 href 属性中指定的相对路径访问.特别是,包含应用程序 JAR 和 JNLP 文件的目录还必须有一个包含布局 JAR 的 lib 目录.

<前>测试/应用程序.jnlp应用程序.jar库/摆动布局1.0.4.jar

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 ?

解决方案

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

这篇关于jws 应用程序无法加载摆动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆