JDK-6401361 : jexec reports bad magic number: Exec format error
  • Type: Bug
  • Component: tools
  • Sub-Component: launcher
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2006-03-21
  • Updated: 2011-02-16
  • Resolved: 2006-08-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6 b95Fixed
Description
FULL PRODUCT VERSION :
[jwi@stujwi maven-jar-test]$ java -version
java version "1.6.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-beta-b59g)
Java HotSpot(TM) Client VM (build 1.6.0-beta-b59g, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Fedora Core 4

Linux stujwi.eur.ad.sag 2.6.15-1.1833_FC4 #1 Wed Mar 1 23:41:37 EST 2006 i686 i686 i386 GNU/Linux


EXTRA RELEVANT SYSTEM CONFIGURATION :
Installation was done via RPM and seems to be successful:

[jwi@stujwi maven-jar-test]$ cat /proc/sys/fs/binfmt_misc/jexec
enabled
interpreter /usr/java/default/lib/jexec
flags:
offset 0
magic 504b0304


A DESCRIPTION OF THE PROBLEM :
A jar file can be executed via "java -jar", but not with jexec.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Create a jar file with the mainClass attribute in the MANIFEST. The jar file can be executed:

[jwi@stujwi maven-jar-test]$ java -jar test.jar
Ok


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
[jwi@stujwi maven-jar-test]$ /usr/java/default/jre/lib/jexec test.jar
Ok

ACTUAL -
[jwi@stujwi maven-jar-test]$ /usr/java/default/jre/lib/jexec test.jar
bad magic number: Exec format error


REPRODUCIBILITY :
This bug can be reproduced always.

Comments
EVALUATION The submitter of the incident report informs me that the jar file was created using Maven 2 which most likely doesn't set the required "0xcafe" tag in the jar file. (We've been really bad about informing the world about this, partly because we do it rather sloppily - not in agreement with zip best practices. Ah, history.) Verification will be forthcoming. That said, "bad magic number: Exec format error" is a really bad diagnostic message. It makes it sound like there is something wrong with jexec and its magic number rather than the jar file and its magic numbers. If nothing else, this message should be improved. This is probably rather important because people will be building jars with other than the jar command and we should be very clear why that fails.
02-06-2006

EVALUATION Don't consider this a complete evaluation. In the sense that jexec is not documented for independent execution, there is no defect here. We never asserted that jexec could be executed directly. As a matter of fact, we never publically said anything about jexec. However, this is curious as to why it fails. The failure should be understood before this report is closed.
02-05-2006