Executable Programs with Guile Arne Babenhauserheide (06 Jul 2016 21:50 UTC)
Re: Executable Programs with Guile taylanbayirli@xxxxxx (06 Jul 2016 23:20 UTC)
Re: Executable Programs with Guile Marc Nieper-Wißkirchen (07 Jul 2016 06:24 UTC)
Re: Executable Programs with Guile Per Bothner (07 Jul 2016 06:52 UTC)
Re: Executable Programs with Guile Marc Nieper-Wißkirchen (07 Jul 2016 07:14 UTC)
Re: Executable Programs with Guile John Cowan (07 Jul 2016 11:09 UTC)
Re: Executable Programs with Guile Per Bothner (07 Jul 2016 12:30 UTC)
Re: Executable Programs with Guile John Cowan (07 Jul 2016 14:49 UTC)

Re: Executable Programs with Guile John Cowan 07 Jul 2016 11:09 UTC

Per Bothner scripsit:

> FWIW: I was surprised to find out you can concatenate a shell script
> with the .jar (Java Archive) file, and have the shell script call
> something like 'exec java -jar $0'.  I.e. the java command can skip
> the shell-script preamble when looking for the jar contents.  So that
> may be a possible approach for Java and other JVM-based implementations.

Indeed.  Jar files are in zip format, and the directory in a zip-format
file is at the end.  Only portions of the file referenced by the directory
will be processed by any unzipper, so arbitrary content can be prepended
to the file without disturbing its validity as a zip file.

In MS-DOS days it used to be popular to put a small self-unzipper there,
so that people without unzip could just run the zipfile (if it had an
extension of .EXE) and it would extract its own contents.  If you were
not on MS-DOS, the self-unzipper wouldn't work, but you could still use
an unzip tool.

The program unzipsfx, distributed along with unzip, can still do this,
but can of course only extract when run on the type of system it was
compiled for.  The whole idea is not very popular any more.

--
John Cowan          http://www.ccil.org/~cowan        xxxxxx@ccil.org
Fundamental thinking is ha-ard.  Let's go ideology-shopping.
                        --Philosopher Barbie