[27] in java-interest

home help back first fref pref prev next nref lref last post

Directly executing Java binaries

daemon@ATHENA.MIT.EDU (patl@asimov.lashley.slip.netcom.co)
Sun Apr 30 22:27:09 1995

From: patl@asimov.lashley.slip.netcom.com
Date: Sun, 30 Apr 1995 19:13:42 -0700
To: java-interest@java.Eng.Sun.COM

Unless I've missed something (quite possible), the only way to execute
a java program is to directly invoke the java interpreter, passing the
program filename as a parameter.  (Or by running a shell script that
does that.)

This seems unnecessarily awkward; and I'd like to propose a simple
solution:

    1.	Modify the java interpreter so that if the .class file being
	loaded starts with '#!', it will ignore everything up through
	the first NEWLINE character.  (I haven't checked the bytecodes,
	but I am assuming that that is a very unlikely initial code
	sequence...)

    2.	Modify the java compiler to put '#!java\n' at the beginning
	of the output file, and to make the file executable, when
	the class contains a 'static main' declaration.

I realize that this solution is probably very unix-centric.  But the
other systems provide no similar functionality; so it shouldn't hurt
anything.  (And I wouldn't be surprised if POSIX hasn't standardized
the '#!' technique...)

-Pat

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post