1

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/javascript">
        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?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301

2 Answers2

1

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!

AlexR
  • 114,158
  • 16
  • 130
  • 208
  • It works with `.`, but only if I upload the stuff to a server. Not if I open the html file locally. – Bart van Heukelom Dec 14 '10 at 17:09
  • For an embedded JWS applet, Sun said to remove the codebase attribute completely (note that is not the same as having it there with a blank value). In that event the codebase is assumed to be the location of the applet HTML - wherever the applet page that embeds it occurs. – Andrew Thompson Dec 15 '10 at 02:54
  • Good point, Andrew. I did not know that. I will try this method next time I am developing using JNLP. – AlexR Dec 15 '10 at 07:20
0

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">
ib11
  • 2,530
  • 3
  • 22
  • 55