Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: noClassDefFoundError trying to run JNLP file with Web Start

  1. #1
    Junior Member
    Join Date
    Sep 2011
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default noClassDefFoundError trying to run JNLP file with Web Start

    I am attempting to run a swing application on my site; I created the jar with my class file as its sole member, and wrote the JNLP file below. But when I try to run the JNLP with Web Start either from the browser or my desktop, I keep getting this error which I've shown under the JNLP code. I am new at this so can anyone tell if I am making any obvious errors?

    <?xml version="1.0" encoding="utf-8"?>
    <!- JNLP File for the PageData Application ->
    <jnlp
    	codebase="---------------"
    	href="PageData.jnlp">
    	<information>
    		<title>PageData Application</title>
    		<vendor>Me</vendor>
    		<homepage href="----------------"/>
    		<icon href="pagedataicon.gif"/>
    		<offline-allowed/>
    	</information>
    	<resources>
    		<j2se version="1.7"/>
    		<jar href="PageData.jar" main="true"/>
    	</resources>
    	<security>
    		<all-permissions/>
    	</security>
    	<application-desc main-class="PageData"/>
    </jnlp>

    java.lang.NoClassDefFoundError: PageData (wrong name: PageData/PageData)
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(Unknown Source)
    	at java.security.SecureClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.defineClass(Unknown Source)
    	at java.net.URLClassLoader.access$100(Unknown Source)
    	at java.net.URLClassLoader$1.run(Unknown Source)
    	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)


  2. #2
    Junior Member
    Join Date
    Sep 2011
    Posts
    21
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: noClassDefFoundError trying to run JNLP file with Web Start

    Finally got it working, just thought I'd update this post with my solution in case it can help anyone else with the same problem. I'm not even sure why it works, but this is what I did: In my first post, I had created the JAR from the command line with the class file as its only member. I tried a few more times using Eclipse 1.4 instead, and in generating the JAR file it didn't work with my JNLP until I specified the main class in the field titled "select the class of the application entry point" on the "Manifest Specification" section of options. Once I did this, I updated my JNLP file to reflect the new path of the main class (now it's PageData.PageData) since my JAR file was now the entire project instead of just the class file. Then I signed my JAR and it ran fine once I uploaded it to my server. Again, not sure why this works because I don't really understand what specifying the main class in the JAR manifest even does, or what a manifest even is. Could anyone explain?
    Last edited by sonicjr; October 13th, 2012 at 02:02 AM.

Similar Threads

  1. Java and JNLP
    By parvendra in forum Java Theory & Questions
    Replies: 9
    Last Post: March 4th, 2011, 10:04 AM
  2. Read in file and store in 2D array start of The Game of Life
    By shipwills in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 2nd, 2011, 09:52 AM
  3. JNLP webstart application in localhost
    By Jhovarie in forum Threads
    Replies: 2
    Last Post: February 14th, 2011, 06:53 PM
  4. can't start jnlp file
    By NARs in forum Java Applets
    Replies: 1
    Last Post: December 1st, 2009, 03:25 AM
  5. [SOLVED] Java code to embedding xml tags at start and end of file
    By John in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: April 30th, 2009, 03:02 PM