Java 小程序 jnlp + 库 [英] Java applet jnlp + libraries

查看:27
本文介绍了Java 小程序 jnlp + 库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向小程序添加库.我正在使用 jnlp + 部署 java javascript.一切似乎都配置正确,但是找不到类(类未找到异常).

I am trying to add libraries to applet. I am using the jnlp + deploy java javascript. Everything seems to be configured correctly, bud the classes are not found (class not found exception).

这是我的代码:

JNLP:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="." href="">
    <information>
        <title>KeystoreTestApplet</title>
        <vendor>Paulie</vendor>
    </information>
    <resources>
        <!-- Application Resources -->
        <j2se version="1.6+"
              href="http://java.sun.com/products/autodl/j2se"/>
        <jar href="KeystoreTestApplet.jar" main="true" />
        <jar href="xmlsec-1.4.5.jar" />
        <jar href="xml-apis-1.3.03.jar" />
        <jar href="xercesImpl-2.9.1.jar" />
        <jar href="xalan-2.7.1.jar" />
        <jar href="sunpkcs11.jar" />
        <jar href="serializer-2.7.1.jar" />
        <jar href="commons-logging-api-1.1.jar" />
        <jar href="commons-logging-1.1.jar" />
    </resources>
    <applet-desc 
         name="KeystoreTestApplet"
         main-class="KeystoreJApplet"
         width="600"
         height="370">
           <param name="MAYSCRIPT" value="true"/> 
     </applet-desc>
     <update check="background"/>
  <security>
    <all-permissions/>
  </security>       
</jnlp>

HTML:

<script src="deployJava.js"></script>
<script>
    var attributes = { codebase:'.', code:'KeystoreJApplet', width:600, height:370} ;
    var parameters = {jnlp_href: 'KeystoreTestApplet.jnlp', mayscript: 'true'} ;
    deployJava.runApplet(attributes, parameters, '1.6');
</script>

小程序 jar、html 页面和库 jar 位于同一目录中.

The applet jar, html page and the libraries jars are in the same directory.

感谢您的帮助.

推荐答案

我在一个有点不同的地方发现了实际问题.

I have found the actual problem on a little bit different spot.

这些库不包含在 jnlp 文件的路径中,而是包含在清单中.清单路径已由 IDE 指定为 lib/{library}.jar.所以java在不同的目录中搜索jars.

The libraries are not included from the paths in jnlp file, but in manifest. The manifest paths had been specified by IDE as lib/{library}.jar. So java was searching for the jars in a different directory.

这篇关于Java 小程序 jnlp + 库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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