Created
April 6, 2012 14:47
-
-
Save pditommaso/2320504 to your computer and use it in GitHub Desktop.
Shell script preamble to make a executable JAR self invocable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | |
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, | |
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR | |
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
# | |
MYSELF=`which "$0" 2>/dev/null` | |
[ $? -gt 0 -a -f "$0" ] && MYSELF="./$0" | |
# | |
# Cleanup paths for Cygwin. | |
# | |
case "`uname`" in | |
CYGWIN*) | |
MYSELF=`cygpath --windows --mixed --path "$MYSELF"` | |
;; | |
Darwin) | |
if test -e /System/Library/Frameworks/JavaVM.framework | |
then | |
java_args=' | |
-Dcom.apple.mrj.application.apple.menu.about.name=CloudGem | |
-Dcom.apple.mrj.application.growbox.intrudes=false | |
-Dapple.laf.useScreenMenuBar=true | |
-Xdock:name=CloudGem | |
' | |
fi | |
;; | |
esac | |
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