Results 1 to 4 of 4
  1. #1
    AndrewM16921 is offline Senior Member
    Join Date
    Jan 2009
    Location
    CA, USA
    Posts
    264
    Rep Power
    6

    Default java.lang.NoClassDefFoundError

    I'm trying to put my JApplet on a webpage. This is the first time I'm actually trying to put something outside of Eclipse other than a couple of random jar files (yeah I'm that new). So anyway, this is the code I used but I keep getting java.lang.NoClassDefFoundError. The applet won't load. :(

    Java Code:
    <html>
    <head>
    <title>Falling Sand</title>
    </head>
    <body>
    <applet
    code = "Driver.class"
    codebase = "http://www.freewebs.com/andrewm16921/FallingSand/"
    width = 400
    height = 450>
    </applet>
    </body>
    </html>
    Java Code:
    package FallingSand;
    
    import javax.swing.JApplet;
    
    public class Driver extends JApplet
    {
    	private final int WIDTH = 400, HEIGHT = 450;
    	public void init()
    	{
    		getContentPane().add(new SandPanel());
    		setSize(WIDTH, HEIGHT);
    	}
    }
    SandPanel is a JPanel, and I've uploaded those and the approximately 20 other classes into the directory http://www.freewebs.com/andrewm16921/FallingSand/
    (You can also click there to see the problem in index.html).
    Last edited by AndrewM16921; 09-29-2009 at 05:38 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Read the Applets tutorial.

  3. #3
    AndrewM16921 is offline Senior Member
    Join Date
    Jan 2009
    Location
    CA, USA
    Posts
    264
    Rep Power
    6

    Default

    As usual, Sun's website and tutorials are completely confusing and only make things more complicated for a semi-beginner, like myself.

    Java Code:
    <html>
    <head>
    <title>Falling Sand</title>
    </head>
    <body>
    <applet
    code = "Driver.class"
    codebase = ""
    archive = "FS.jar"
    width = 400
    height = 450/>
    </applet>
    </body>
    </html>
    The only thing I can think of is the codebase issue. I have FS.jar in the same directory as index.html, so should it just be codebase = "" ?

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    What I was going to say is in Sun's tutorial so I won't post it since it will confuse you.

Similar Threads

  1. java.lang.NoClassDefFoundError
    By noobie in forum Java Applets
    Replies: 5
    Last Post: 04-22-2009, 03:35 AM
  2. java.lang.NoClassDefFoundError:
    By jeepcreep11 in forum New To Java
    Replies: 3
    Last Post: 03-13-2009, 12:58 PM
  3. java.lang.NoClassDefFoundError
    By bizmut in forum Eclipse
    Replies: 3
    Last Post: 06-15-2008, 01:54 AM
  4. java.lang.NoClassDefFoundError
    By J_a_y in forum New To Java
    Replies: 2
    Last Post: 08-07-2007, 12:51 PM
  5. java.lang.NoClassDefFoundError
    By fred in forum Advanced Java
    Replies: 3
    Last Post: 08-01-2007, 06:00 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •