Re: NoClassDefFoundError



Eli Luong wrote:
I was wondering what the reason is behind this. I recently installed
the Java 5.0 SDK. Compiling *.java files seems to work fine, but
whenever I try to run something, it gives me that NoClassDefFoundError.
I've seen a solution is to run it as java -classpath . ClassName, but
that's some strange workaround I don't like. Why is this happening? Do
I have to install the SDK in a directory that contains no spaces? By
default it ended up in Program Files\Java.

Thanks,
- Eli


You shouldn't need a classpath to run a class in the current directory if it has no package. Check to make sure that you don't have a classpath specified in the environment. If you do, it could be that it doesn't have . in it like it should.

--

Knute Johnson
email s/nospam/knute/
.



Relevant Pages

  • Re: IDE Recommendation
    ... >>i use java sdk - straight download from java.com site ... >> i'd like to use an ide that uses the sdk that i downloaded ... The Java IDE is built ...
    (comp.lang.java.programmer)
  • compile/run locations
    ... on the JAVA 2 SDK 1.4.2 installation notes for Microsoft ... the fact that i'm able to execute JAVA programs in the foregoing manner ...
    (comp.lang.java.help)
  • Re: Different compilers = Different byte code?
    ... >installed your applet. ... Restricts the class files to work only on a specific VM version. ... all VMs in the Java 2 SDK. ... Java 2 SDK, v 1.2 And Later Generates the class files to run only on ...
    (comp.lang.java.programmer)
  • Re: Deeper java problem
    ... IBM 31-BIT SDK FOR Z/OS JAVA 2 V5 ...
    (bit.listserv.ibm-main)
  • Re: Java problems
    ... > Murray Sutherland wrote: ... > What is happening is that I have installed 2 Java IDE's ... > both of which install a copy of the SDK with the Install. ... > This seems to have stuffed up the something (be it JRE or SDK) ...
    (comp.lang.java.developer)