Friday, December 12, 2014

Incompatible magic value 1347093252 in class file

The error describes exactly which is problem: your class file does not start as all java class should, i.e. with 3405691582 (or in hexadecimal CAFEBABE). Instead, your class starts with 1347093252 (hexadecimal 504B0304) that, as indicated in the reference below, it the beginning of a zip/jar file.

How can it happen? Well in my case, I got this problem when I created a jar file to store some of my classes and I used the command:

jar cf my_package1.jar /path/to/classes/*

and clearly something went wrong.
How did I solve it? I slightly changed the command for the jar file in:

jar cf my_package1.jar /path/to/classes/*.class


And everything went OK.

Reference:
http://www.coderanch.com/t/411141/java/java/Imcompatible-Magic-Number

No comments:

Post a Comment

Your comment will be visible after approval.