aspose file tools*
The moose likes Applets and the fly likes Incompatible magic value, ahem ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Incompatible magic value, ahem ?" Watch "Incompatible magic value, ahem ?" New topic
Author

Incompatible magic value, ahem ?

Morten Frost
Greenhorn

Joined: Oct 02, 2006
Posts: 1
Hey there

I have stumpled upon a problem I have never encountered before.
It has to do with the execution of an Applet.

Now...
I have three .jars:
- a.jar (The actual testing applet)
- commons-logging-api.jar
- jmimemagic-0.1.0.jar

commons-logging-api.jar and jmimemagic-0.1.0.jar are external libraries which is used throughout the main applet code. I have placed these libraries on a webserver, and link directly to them at their server location in the applet "archive" attribute. (archive="a.jar,http://....../jmimemagic-0.1.0.jar, http://....../commons-logging-api.jar).

If I run the applet locally, everything executes as expected, but once I move "a.jar" to the server aswell, I receive this weird error: "Incompatible magic value".

Stacktrace follows:
Exception in thread "Thread-1989" java.lang.ClassFormatError: Incompatible magic value 537528842 in class file
at java.lang.ClassLoader.defineClass1(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 org.apache.commons.logging.LogFactory$2.run(LogFactory.java:571)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.commons.logging.LogFactory.newFactory(LogFactory.java:561)
at org.apache.commons.logging.LogFactory.getFactory(LogFactory.java:332)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
at net.sf.jmimemagic.Magic.<clinit>(Magic.java:46)

Any help would be much appreciated.

Regards,
Morten
Meghna Bhardwaj
Ranch Hand

Joined: Jun 08, 2007
Posts: 109
Hi,

I realize this is an old issues however, I just ahd the same problem and wanted to post a reply so it might help others who are experienceing this.

I had 2 versions of Java installed 1.4 and 1.6 and was getting this error about java.lang.ClassFormatError: Incompatible magic value

I just uninstalled Java 1.4 from Start->Control panel-> Add/remove programs and restarted my machine. The error went away instantly.

Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Incompatible magic value, ahem ?
 
Similar Threads
Applet only works with one Java version
Jobfuscate
FTPclient by org.apache.commons hangup...
Jnlp cannot find the main class in a Jar packaged using "OneJar".
error in applet notinited