Re: Exception in thread "main" java.lang.NoClassDefFoundError



On 30 Sep 2005 08:53:06 -0700, thickface wrote:
> Thanks. That works!
> I would really appreciate it if you would explain why this happens and
> how I prevent this from happening again.

Java searches a "classpath" to find the classes it needs. It's either
specified on the command line with -cp, or in an environment variable
CLASSPATH.

Apparently the current directory (".") wasn't mentioned.

More information is here:

http://java.sun.com/j2se/1.5.0/docs/tooldocs/solaris/classpath.html
http://java.sun.com/j2se/1.5.0/docs/tooldocs/findingclasses.html

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
.



Relevant Pages

  • RE: NoClassDefFoundError after upgrade to FC3
    ... it's a lot harder to figure out what is missing. ... Check the script that starts the IDE and see if it is setting a classpath. ... Sometimes the CP is set using a command line option of the java command ... NoClassDefFoundError after upgrade to FC3 ...
    (Fedora)
  • Re: Question for Java Gurus
    ... > people running into classpath issues while doing command line work. ... in which case it's clear that their environment is impeding their ... success at learning Java. ... programming, that's a negligible space of education. ...
    (comp.lang.java.programmer)
  • Re: Question for Java Gurus
    ... > people running into classpath issues while doing command line work. ... in which case it's clear that their environment is impeding their ... success at learning Java. ... programming, that's a negligible space of education. ...
    (comp.lang.java.help)
  • Re: Question for Java Gurus
    ... > people running into classpath issues while doing command line work. ... in which case it's clear that their environment is impeding their ... success at learning Java. ... programming, that's a negligible space of education. ...
    (comp.lang.java.softwaretools)
  • Re: Java server wont run after reboot
    ... > package definitions in your source code. ... Execute from that directory, no classpath definition needed. ... > java HelloWorld ... > If you compile to a different location, ...
    (RedHat)