• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jnlp cannot find the main class in a Jar packaged using "OneJar".  RSS feed

Vishnu Shankar Pandey
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Felows,

I have a Jnlp trying to load an applet from a jar("a.jar") which has in turn been packaged into a bigger "project.jar".
To package the project resources into "project.jar",i have used the open source tool "OneJar".
The main class 'applet_name' is present in "a.jar".

The Manifest of ant build task to package the project jars using "One-Jar " is:

<attribute name="Main-Class" value="com.simontuffs.onejar.Boot "/>
<attribute name="One-Jar-Main-Class" value="abcd.efgh.xyz.applet.applet_name"/>
<fileset file="${src.dir}/a.jar"/>
<fileset file="${src.dir}/otherjars.jar"/>

I have packaged the "a.jar"(containing the applet class) into the main.jar as well as the lib by specifying it in the ant task.

The Code to access it via JNLP is:
<!-- Application Resources -->
<jar href='project.jar' main='true' />

main-class='abcd.efgh.xyz.applet.applet_name' width='1350' height='700'>

The error being thrown here is that the Jnlp cannot find my main class:

java.lang.ClassNotFoundException: abcd.efgh.xyz.applet.applet_name
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)

Any suggestions as to how the jnlp can find the main class(applet_name)..??

Thanks for reading all this..

Tushar Pandey

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!