aspose file tools
The moose likes JNLP and Web Start and the fly likes Jnlp cannot find the main class in a Jar packaged using Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JNLP and Web Start
Reply Bookmark "Jnlp cannot find the main class in a Jar packaged using "OneJar"." Watch "Jnlp cannot find the main class in a Jar packaged using "OneJar"." New topic
Author

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

Vishnu Shankar Pandey
Greenhorn

Joined: Oct 27, 2011
Posts: 1
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:

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


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:
<resources>
<!-- Application Resources -->
<jar href='project.jar' main='true' />

</resources>
<applet-desc
name='Applet_name'
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..

Regards
Tushar Pandey


 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Jnlp cannot find the main class in a Jar packaged using "OneJar".
 
Similar Threads
Incompatible magic value, ahem ?
[Ant] Run a jar file throw java.lang.NoClassDefFoundError: app/main/Main and Could not find the main
Including a jar within a jar
Apache Ant add property file and policy file
ClassNotFoundException: com.mysql.jdbc.Driver