Skip to content

Instantly share code, notes, and snippets.

@qmx
Forked from briandealwis/gist:782862
Created September 22, 2012 07:00

Revisions

  1. @briandealwis briandealwis revised this gist Nov 10, 2011. 1 changed file with 6 additions and 7 deletions.
    13 changes: 6 additions & 7 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    #!/bin/bash
    # 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]
    exec java -Xmx1G -jar "$0" "$@"
    # turn a jar with a Main-Class into a stand alone executable

    (echo '#!/usr/bin/env java -jar'; cat blahblah.jar) > blah

    # turn a jar with a particular main clas into a stand alone executable

    (echo '#!/usr/bin/env java -jar package.MainClass'; cat blahblah.jar) > blah
  2. @briandealwis briandealwis revised this gist Jan 17, 2011. 1 changed file with 8 additions and 13 deletions.
    21 changes: 8 additions & 13 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,13 +1,8 @@
    #!/bin/bash
    # 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 "java -Xmx1G -jar $0"
    else
    eval "java -Xmx1G -jar $0 $commandToRun"
    fi
    exit
    #!/bin/bash
    # 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]
    exec java -Xmx1G -jar "$0" "$@"

  3. @spullara spullara revised this gist Jan 17, 2011. 1 changed file with 11 additions and 8 deletions.
    19 changes: 11 additions & 8 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,13 @@
    #!/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]
    #!/bin/bash
    # 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 " "$@")"
    eval "java -Xmx1G -jar $0 $commandToRun"
    if test "$commandToRun" = "'' "; then
    eval "java -Xmx1G -jar $0"
    else
    eval "java -Xmx1G -jar $0 $commandToRun"
    fi
    exit

  4. @spullara spullara revised this gist Jan 17, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,6 @@
    # then chmod +x [this file]
    # you can now exec [this file]
    commandToRun="$(printf "%q " "$@")"
    eval "java -jar $0 $commandToRun"
    eval "java -Xmx1G -jar $0 $commandToRun"
    exit

  5. @spullara spullara created this gist Jan 17, 2011.
    10 changes: 10 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/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 " "$@")"
    eval "java -jar $0 $commandToRun"
    exit