Monday, December 17, 2007

Lesson: Common Problems (and Their Solutions) (The Java™ Tutorials > Getting Started)

Lesson: Common Problems (and Their Solutions) (The Java™ Tutorials > Getting Started): "Exception in thread 'main' java.lang.NoClassDefFoundError: HelloWorldApp/class
A common mistake made by beginner programmers is to try and run the java launcher on the .class file that was created by the compiler. For example, you'll get this error if you try to run your program with java HelloWorldApp.class instead of java HelloWorldApp. Remember, the argument is the name of the class that you want to use, not the filename.
Exception in thread 'main' java.lang.NoSuchMethodError: main
The Java VM requires that the class you execute with it have a main method at which to begin execution of your application. A Closer Look at the 'Hello World!' Application discusses the main method in detail."

No comments: