开发者

Java applet jnlp + libraries

开发者 https://www.devze.com 2023-03-16 09:55 出处:网络
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).

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).

Here is my code:

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>

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

Thanks for your help.


<jnlp spec="1.0+" codebase="." href="">
  • If this is an embedded applet, leave the codebase out.
  • If the applet is free floating, use an explicit (not relative) URL for the codebase.

While you're at it, either specify a sensible value for the href, or remove the entire field.


It also pays to validate JNLP files when they don't work as expected. I (helped write &) recommend JaNeLA.


BTW - is mayscript supported in JNLP applets?


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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消