This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Applets and the fly likes What is Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "What is "java.lang.ClassFormatError: bad magic number"?" Watch "What is "java.lang.ClassFormatError: bad magic number"?" New topic

What is "java.lang.ClassFormatError: bad magic number"?

Gary Bryan

Joined: Sep 16, 2000
Posts: 9
I have written an applet, and when I try to load it on the Internet, i get an error like the above. It works fine locally, it's just on the Internet it doesn't work. The applet fails to load because of this.
Gary Bryan

--<BR>Gary Bryan<BR>
Noah Carroll
Ranch Hand

Joined: Sep 20, 2000
Posts: 96
I believe you get that error when the class file cannot be found. Make sure you have the correct path to it and remember that capitalization does count for the applet name.
[ March 31, 2008: Message edited by: Noah Carroll ]
Brooks Duncan

Joined: Oct 16, 2000
Posts: 5
I have gotten that error when I have somehow gotten a corrupt .class file. Usually it happens when I forget to put the jar name when I try to jar something, and it ends up screwing up all the class files in the folder.
Try recompiling your .java file(s) and see if that helps.
It is sorta covered in the JavaRanch Style Guide.
subject: What is "java.lang.ClassFormatError: bad magic number"?
Similar Threads
How to take jaworski test offline ?
Bad Magic Number
Swing in IE 5
destroying downloaded files
Runing Applet that deal withe sound file