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

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

问题描述

我有一个使用swing-layout的旧应用程序,我必须通过java webstart使它可用。它从netbeans运行良好但如果我使用jws启动它我得到了这个错误:

 线程中的异常AWT-EventQueue-0 java.lang.NoClassDefFoundError:org / jdesktop / layout / GroupLayout $ Group 
at Gui.Accueil.jMenuItemConsPHActionPerformed(Accueil.java:2331)
.....
引起: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)
在java.lang.ClassLoader.loadClass(未知来源)
在java.lang.ClassLoader.loadClass(未知来源)
... 41更多

我试图在jnlp文件中添加swing-layout,但是当我运行它时出现这个错误:

  com.sun.dep loy.net.FailedDownloadException:Impossible de charger la ressource:http:// my_url:8080 / ___ JWSappclient / ___ app / test / lib / swing-layout-1.0.4.jar 

这是jnlp:

 < jnlp spec = 1.0+codebase =href => 

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

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

< / jnlp>

谢谢。



第一编辑:



我已删除并尝试使用多个路径,但它几乎相同的错误 com.sun.deploy.net.FailedDownloadException :不可能充电器资源:http://url/___JWSappclient/___app/test/lib/swing-layout-1.0.4.jar



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

解决方案

元素< eligible> 未出现在 JNLP文件语法 ,您的文件格式错误,如图所示。在关于此主题的上一个问题中,您提到需要支持Java 6.要支持Java 5,请在<$中指定它C $ C><资源> 。包含 org.jdesktop.layout.GroupLayout 的JAR显示正确,但路径可疑。试试这样的事情:

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

附录:我不明白为什么JWS会尝试下载 swing-layout.jar 来自服务器



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

 
test /
application.jnlp
application.jar
lib /
swing-layout-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应用程序无法加载swing-layout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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