Skip to content

Create Linux run file from a Java jar

Enter the following in a file called stub.sh:

#!/bin/sh 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"fiexec"$java" $java_args -jar $MYSELF "$@"exit1


Next, type the following into a terminal.

cat stub.sh helloworld.jar > hello.run && chmod +x helloworld.run