Skip to content

Instantly share code, notes, and snippets.

@micalevisk
Last active March 17, 2018 21:06
Show Gist options
  • Save micalevisk/32d6a04b774827d4366a195c507294b9 to your computer and use it in GitHub Desktop.
Save micalevisk/32d6a04b774827d4366a195c507294b9 to your computer and use it in GitHub Desktop.
[Linux] JAR to Executable
#!/bin/bash
# (c) https://coderwall.com/p/ssuaxa/how-to-make-a-jar-file-linux-executable
# $ cat stub.sh helloworld.jar > hello.run && chmod +x helloworld.run
MYSELF=`which "$0" 2>/dev/null`
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0"
java=java
if test -n "$JAVA_HOME"; then
java="$JAVA_HOME/bin/java"
fi
exec "$java" $java_args -jar $MYSELF "$@"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment