File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "JNLP Error" Watch "JNLP Error" New topic
Author

JNLP Error

Malcolm Grayson
Greenhorn

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+"
codebase="file://localhost/c:/home/jnlp_test"
href="spool.jnlp">
<information>
<title>Spool Tool Application</title>
<vendor>M.Grayson</vendor>
<homepage href="../rail/Index.html"/>
<description>AD HOC QUERY TOOL</description>
<description kind="short">2.0 Spool Tool</description>
<icon href="crossbuck.jpg"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<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"/>
</resources>
<resources>
<os="Windows"/>
<nativelib href="http://MyServer/lib/jacob_dll.jar"/>
</resources>
<application-desc main-class="spool.client.Main"/>
</jnlp>

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


-kolli
Malcolm Grayson
Greenhorn

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

Thanks
Paresh Wankhede
Greenhorn

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

This should help you out.

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

.. Paresh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNLP Error