hi i have written simple java program;i am using JDK 1.3.1 version;i am running this program on WindowsME;i set the classpath properly;compiled well; but when i run the program i get the NoClassDefFoundError;how can i solve this problem bye chaitanya
The surely looks like a Classpath problem. Make sure that everything is set properly (check capitalization, as well). If you have the class defined in a package, is it placed in the proper directory structure to mimic that package? (i.e. foo.bar.baz.TestClass should be in C:\foo\bar\baz.) Corey
I've noticed that many programmers new to packages in Java will compile the source files just fine, put the class files in the appropriate directory structure according to the package declarations, then fail to run a specified class file from the appropriate directory. In other words, if the file Hello.class belongs to the package fred and is in fact in a directory named fred, the programmer will try to run the class Hello.class from within the directory fred like so: c:\fred>java Hello or c:\fred>java fred.Hello which will not work. The proper place to run Hello from is from the parent directory of fred like so: c:\>java fred.Hello But perhaps this is not your problem... Good Luck.
Another point to be wary of that could produce the exception that is causing you troubles: Don't specify the .class file extension when running a Java program like this: c:\>java Hello.class rather do it like this: c:\java Hello Good Luck.