开发者

How to specify applet libraries in JNLP file

I'm trying to deploy an applet using JNLP. The file structure is thus:

/
  dbstats.html
  dbstats.jnlp
  dbstats.jar
  lib/
    substance.jar
    trident.jar
    guava-0.7.jar

Here's my HTML:

<html>
    <head>
        <title>Dreambearstatistieken</title>

        <script src="http://www.java.com/js/deployJava.js"></script>
        <script type="text/javascript">

            var attributes = {
                code:'dreambear.stats.viewer.DBStatsViewer',
                width:900, height:600
            };
            var parameters = {jnlp_href: "dbstats.jnlp"};
            var version = "1.6";

        </script>

    </head>
    <body>

    <script type="text/javasc开发者_C百科ript">
        deployJava.runApplet(attributes, parameters, version);
    </script>

    </body>
</html>

And the JNLP file:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="" href="">
    <information>
        <title>Dreambearstatistieken</title>
        <vendor>Weber</vendor>
    </information>
    <resources>
        <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
        <jar href="lib/trident.jar" />  
        <jar href="lib/substance.jar" />
        <jar href="lib/guava-r07.jar" />
        <jar href="dbstats.jar" main="true" />
    </resources>
    <applet-desc 
         name="Dreambearstatistieken"
         main-class="dreambear.stats.viewer.DBStatsViewer"
         width="900"
         height="600">
     </applet-desc>
     <update check="background" />
</jnlp> 

As far as I can see, everything should be ok, but it's not. I get a ClassNotFoundException on org.pushingpixels.substance.api.skin.SubstanceNebulaLookAndFeel, which is in substance.jar. What am I doing wrong?

And wider, is there a good tutorial or book about using applets and JNLP in the 2010s?


First your codebase is empty. As far as I remember it should contain the absolute path to your application. Probably I am wrong but start from this. If it helps but you wish to reuse the jnlp file try codebase="." (although I am not sure it is legal.)

Next, try to download one of the jars under lib directory using browser. It is needed to be sure that this directory is accessible.

Good luck!


You have to put the jlnp's name on href="" as well. Do it like this:

<jnlp spec="1.0+" codebase="http://mydomain:5500/myapp" href="dbstats.jnlp">
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜