Martian Software, Inc. logo

jar2sh v0.1

May 4, 2009

jar2sh is a bash shell script that wraps Java applications into bash scripts that can be run without any installation. It's sort of like launch4j or exeJ, but for *nix.

If jar2sh does not meet your needs, perhaps jnix will.

How it Works

The jar files comprising the application are bundled via tar and gzip. A unique "bundle id" is computed based upon the md5 of the result and a timestamp. The target shell script is written and includes the contents of this tar.gz file.

When the script is run, a cache directory ($HOME/.jar2sh-cache) is checked to see if an application with the same name and bundle id has already been unbundled. If it has not, app is then unbundled. Finally, it is launched via java (which is assumed to be installed and in the user's $PATH) using the jars in the cache directory.

The application may be a single executable jar (which you would normally launch with "java -jar JARFILE" or may require that the main class be specified with just the "java" command. Any number of additional jars may be included as well — they're just added to the classpath.

For usage information, just run [jar2sh] with no arguments.

License

jar2sh is licensed under the GNU General Public License.

The scripts it produces are not - they are yours and yours alone, to use at your own risk.