Welcome, Guest. Please Login
Interdesigner Software Development
  Visit Shutdown Manager and Tools today Wink
Strange Java Error: Bad Magic Number (Read 8,859 times)
Jun 1st, 2005 at 9:03am

Daniel   Offline
YaBB Administrator

Gender: male
Posts: 185
Quote Quote 
Maybe this post will help anyone with this problem. I tried, since last week, to use the web demonstration of Visualroute, but I got a strange error:
Bad Magic Number
. After requesting support (they forgot me, I assume  Cheesy), I was surprised why the error appears only on one Desktop computer and not the others.

Unsuccessful solutions  ??? :

  • Reinstall Java Runtime
  • Installing even Java SDK
  • Clearing Internet Explorer Cache
  • Trying to refresh the page several times
  • Requesting support (I even sent a detailed MSINFO32) file  Undecided
  • Using Java Control Panel option "Clear Cache"
  • Reboot
  • Google for this error (apparently this error is not common to a simple solution)
  • Manually delete the VisualRoute* files from Java Cache


Debugging the error, I decided to clear some VisualRoute* files from a special Java Folder:

C:\Documents and Settings\DSM\Application Data\Sun\Java\Deployment\cache\javapi\v1.0\file

Simple, but a little hard to find.

Java Console

java.lang.ClassFormatError: VisualRouteApplet (Bad magic number)

     at java.lang.ClassLoader.defineClass0(Native Method)

     at java.lang.ClassLoader.defineClass(Unknown Source)

     at java.security.SecureClassLoader.defineClass(Unknown Source)

     at sun.applet.AppletClassLoader.findClass(Unknown Source)

     at java.lang.ClassLoader.loadClass(Unknown Source)

     at sun.applet.AppletClassLoader.loadClass(Unknown Source)

     at java.lang.ClassLoader.loadClass(Unknown Source)

     at sun.applet.AppletClassLoader.loadCode(Unknown Source)

     at sun.applet.AppletPanel.createApplet(Unknown Source)

     at sun.plugin.AppletViewer.createApplet(Unknown Source)

     at sun.applet.AppletPanel.runLoader(Unknown Source)

     at sun.applet.AppletPanel.run(Unknown Source)

     at java.lang.Thread.run(Unknown Source)

The class definition files (*.class) for Java applets are loaded over the network. Sometimes during the transmission of files, the connection may be aborted, or may be scrambled, causing class loading to fail. Sometimes when copying files over to a web server, they may become garbled or a disk error might occur. For this reason, special care is taken by the JVM and the class loader, to verify that classes are intact. One of the precautions is that every class definition contains at the beginning the magic number, a sequence of four bytes that identify a file as a Java class definition file.

For those curious to know what the magic number is, it is the hexadecimal number CAFEBABE, which is used by the class loader to see if a file is really a class definition file. Please don't ask me why it spells out cafebabe - my guess it was an attempt at humor.

IP Logged