wood burning stoves
The moose likes JNLP and Web Start and the fly likes JNLP Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JNLP Error" Watch "JNLP Error" New topic

JNLP Error

Malcolm Grayson

Joined: Apr 01, 2008
Posts: 2
I am having trouble with running my java application from the jnlp. The jnlp and the jar it is refering to are in the same directory (c:\home\jnlp_test\). The jnlp error is:

java.lang.ClassNotFoundException: spool.client.Main
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

The troubling part is that I can verify that the Main.class IS in the spool.jar. Furthermore I can run spool.jar from a batch file without problem. This leads me to believe that the error is with the jnlp itself.

Here is the jnlp file:

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Application -->
<jnlp spec="1.0+"
<title>Spool Tool Application</title>
<homepage href="../rail/Index.html"/>
<description>AD HOC QUERY TOOL</description>
<description kind="short">2.0 Spool Tool</description>
<icon href="crossbuck.jpg"/>
<j2se version="1.4"/>
<jar href="file://localhost/c:/home/jnlp_test/spool.jar"/>
<jar href="http://MyServer/lib/jacob.jar"/>
<jar href="http://MyServer/lib/jxl.jar"/>
<jar href="http://MyServer/lib/classes12.jar"/>
<nativelib href="http://MyServer/lib/jacob_dll.jar"/>
<application-desc main-class="spool.client.Main"/>

I'm stumped! Can anyone shed some light onto this problem. Thanks in advance. Cheers!
Ravikanth kolli
Ranch Hand

Joined: Feb 10, 2008
Posts: 179

I think the problem is with the jar file declaration

We should have just spool.jar rather than the complete path for the file. I too had similar problems and i found out that href actually tries to locate the file based on the codebase that is intially specified. So i think just mentioning spool.jar would help.

And also a "/" within the codebase something like
since we are refering to a directory and we are using as a base directory for all the other references.

Hope this helps.

Malcolm Grayson

Joined: Apr 01, 2008
Posts: 2
Thanks for the reply. I adjusted my code as you suggested, but the error still remains.
Ravikanth kolli
Ranch Hand

Joined: Feb 10, 2008
Posts: 179

As there are multiple jar declarations we should specify which one if it is the main jar that has the main file. So we need to specify something like this to spool.jar

Think this one does the trick..

Paresh Wankhede

Joined: Sep 08, 2006
Posts: 12
keep the entry of your source jar as the lastr entry as given below.

This should help you out.

<j2se version="1.4"/>
<jar href="./lib/jacob.jar"/>
<jar href="./lib/jxl.jar"/>
<jar href="./lib/classes12.jar"/>
<jar href="./spool.jar"/>

.. Paresh
I agree. Here's the link: http://aspose.com/file-tools
subject: JNLP Error
It's not a secret anymore!