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

Wednesday, December 3, 2014

How to run 32 bit applications on a 64bit linux machine

Got the nasty "bad ELF interpreter" error message trying to run a 32bit command line application?
You probably miss some shared library!
How to solve it?

Run a check on the missing shared libraries using the command "ldd" (print shared library dependencies)

ldd <path_to_your_32bit_application>

then install the missing libraries. For example on CentOS/RedHat

yum provides <path_to_the_missing_library>

Done!

Example:

sudo yum provides /lib/libpthread.so.0


References:

http://stackoverflow.com/questions/8328250/centos-64-bit-bad-elf-interpreter