DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: newbie getting java.lang.NoClassDefFoundError

  1. #1
    Join Date
    Dec 2005
    Posts
    1

    newbie getting java.lang.NoClassDefFoundError

    When I try to run a program I'm writing, Bouncy.class, I get

    Exception in thread "main" java.lang.NoClassDefFoundError: Bouncy/class

    Everywhere I look for a solution to this problem it says to add . to the CLASSPATH. I already have it!

    sealth:~/tmp dana$ echo $CLASSPATH
    /System/Library/Java/:.

    The one thing I can see that is odd is that in all the other examples I see the error is the equivalent to "NoClassDefFoundError: Bouncy" whereas I have "NoClassDefFoundError: Bouncy/class". So I figure the problem lies in that extra "/class". Any ideas what the problem is? I'm using a Mac if that affects anything.

  2. #2
    Join Date
    Oct 2005
    Posts
    107
    java.lang.NoClassDefFoundError

    Thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.

    The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.

    I would need more info from you. Does it compile?

  3. #3
    Join Date
    Nov 2004
    Location
    Norway
    Posts
    1,560
    In general, if you compile source file(s) with a package directive, say "package tata;"
    in top of the code, and the compilation is done in folder "abc" then the class files will
    be in folder: "abc/tata".

    To run the program, say MyProg.class (on windows) you navigate to the abc folder and issue the
    command: java ttata.Myprog.

    In your case its the main class that cannot be found.

Similar Threads

  1. newbie. Really Newbie
    By Itai Raz in forum Open Source
    Replies: 2
    Last Post: 09-01-2003, 05:22 PM
  2. Newbie getting started in programming
    By Benno in forum Careers
    Replies: 10
    Last Post: 02-10-2002, 08:07 PM
  3. Is VB.Not still a BEGINNERS' language?
    By Mark Burns in forum .NET
    Replies: 164
    Last Post: 03-13-2001, 01:43 PM
  4. Replies: 1
    Last Post: 12-07-2000, 07:11 PM
  5. Newbie Question about Classes...
    By Anthony Saffer in forum Java
    Replies: 1
    Last Post: 09-22-2000, 11:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center