EVALUATION
The creation of an execution jar file with a Main-Class is not inserting
the LOCEXT entry required by the kernel to identify this file.
Using a test file I was able to get it execed by adding an intermediate
exec routine (presently the args necessary require -new). So, what we
have is:
% /usr/java/lib/jexec -> /home/rie/java/jarexec/jexec
% cat jexec.c
#include <unistd.h>
main(int argc, char * argv[], char * envp[])
{
execle("/usr/java1.2e/bin/sparc/java",
argv[0], "-new", argv[1], argv[2], 0, envp);
}
% ./x.jax
hello
This jar file has a LOCEXT value that allows us to find the magic
java executable signature.
oxpoly 499.. od -x ./x.jax +. | head -16
0000000 504b 0304 1400 0800 0800 2806 be22 0000
0000016 0000 0000 0000 0000 0000 1400 0300 4d45
^^ LOCNAM -> byte 50
^^ LOCEXT == 3
0000032 5441 2d49 4e46 2f4d 414e 4946 4553 542e
0000048 4d46 feca 00f3 4dcc cb4c 4b2d 2ed1 0d4b
^^^^^^^
#define XFJAVASIG 0xcafe /* java executables */
Presently a jar file created using jar with a Main-Class entry point:
oxpoly 503.. od -x ./HelloWorld +. | head -16
0000000 504b 0304 1400 0800 0800 aa72 ad24 0000
0000016 0000 0000 0000 0000 0000 1400 0000 4d45
^^ LOCNAM -> byte 50
^^ LOCEXT == 0
0000032 5441 2d49 4e46 2f4d 414e 4946 4553 542e
0000048 4d46 f34d cccb 4c4b 2d2e d12d 4b2d 2ace
^
The three bytes containing cafe are missing.
---- Rod Evans ---
The JAR tool has been fixed for 1.2Beta4 to add the appropriate magic
number to the extra field data for the first JAR entry. The only difference
is that magic number will be added to all JAR files, not just executable
ones. The java interpreter will display an error if the JAR file does not
contain a "Main-Class" manifest attribute. This change was made in order
to simplify JarOutputStream as otherwise it would be difficult to determine
if the JAR file is executable unless the manifest was specified in advance.
david.connelly@Eng 1998-05-19
varified with recompiled jexec.c
|