Bart van Heukelom Bart van Heukelom - 6 months ago 37
Java Question

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

Answer

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!

Comments