Skip to content

Instantly share code, notes, and snippets.

@spullara
Created January 17, 2011 05:21
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spullara/782523 to your computer and use it in GitHub Desktop.
Save spullara/782523 to your computer and use it in GitHub Desktop.
#!/bin/sh
# simple script for turning a jar with a Main-Class
# into a stand alone executable
# cat [your jar file] >> [this file]
# then chmod +x [this file]
# you can now exec [this file]
commandToRun="$(printf "%q " "$@")"
if test "$commandToRun" = "'' "; then
eval "exec java -Xmx1G -jar $0"
else
eval "exec java -Xmx1G -jar $0 $commandToRun"
fi
@briandealwis
Copy link

Nice discovery! This can be simplified to a single line: https://gist.github.com/782862

@briandealwis
Copy link

This doesn't seem to work any more 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment