Question:
What does it mean when I receive the Java:java.lang.ClassFormatError?I get it whenever I try to implement a ready-made Javaapplication onto my Web site.
Answer:
The ClassFormatError is thrown whenever the class loader determines thefile is malformed or cannot be interpreted as a class file.
I noticed you used the word “application” when describing your Javaprogram. Of course to run under a browser, a Java program must extend theclass Applet and provide an init() method.
Other common reasons for this error are:
- Forgot to compile the .java file into a .class file
- ftp’d the .class file as a text file
- Specified the .java file instead of the .class file in the HTMLAPPLET tag.