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

incompatible magic value

William Stafford
Ranch Hand

Joined: Dec 13, 2004
Posts: 109
I developed an app on my local machine. I was able to run it from Eclipse with no errors.

The app was ported to another machine. When attempting to start the app the following message is displayed:
Exception in thread "main" java.lang.ClassFormatError: Incompatible magic value 4022320623 in class file BatchInsert

I thought this sort of thing was a version incompatibility but the class file is being built with Java 1.5 and the target machine is Java 1.6.

I have looked at a lot of postings about this problem and have not seen a clear cause or cure except in the case of downloaded files which are supposed to be class or jar files but are not.

Any help or guidance would be appreciated,
-=beeky
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
A bad magic number basically means that the file isn't a Java class file, or it has been corrupted.

How did the "port" happen?


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
William Stafford
Ranch Hand

Joined: Dec 13, 2004
Posts: 109
Ilja,
Thanks for answering my question. I hope great minds think alike because I started looking at the 'port' immediately after I posted my question.

The port was done with an Ant script. The port task had filtering="true" for the copy of the class files. Who knows what kind sort of damage was done to the class files by this.

I changed the port to copy the class files without filtering and the problem went away.

Thanks again for taking the time to answer my question,
-=beeky
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: incompatible magic value