launcher.sh-template revision 2571:10fc81ac75b4
177218Sphk#!/bin/sh 277218Sphk 377218Sphk# 477218Sphk# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. 577218Sphk# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 677218Sphk# 777218Sphk# This code is free software; you can redistribute it and/or modify it 877218Sphk# under the terms of the GNU General Public License version 2 only, as 977218Sphk# published by the Free Software Foundation. Oracle designates this 1077218Sphk# particular file as subject to the "Classpath" exception as provided 1177218Sphk# by Oracle in the LICENSE file that accompanied this code. 1291454Sbrooks# 1391454Sbrooks# This code is distributed in the hope that it will be useful, but WITHOUT 1477218Sphk# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1577218Sphk# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1677218Sphk# version 2 for more details (a copy is included in the LICENSE file that 1777218Sphk# accompanied this code). 1877218Sphk# 1977218Sphk# You should have received a copy of the GNU General Public License version 2077218Sphk# 2 along with this work; if not, write to the Free Software Foundation, 2177218Sphk# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2277218Sphk# 2377218Sphk# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2477218Sphk# or visit www.oracle.com if you need additional information or have any 2577218Sphk# questions. 2677218Sphk# 2777218Sphk 2877218Sphkmydir="`dirname $0`" 2977218Sphkcase `uname -s` in 3077218Sphk CYGWIN*) 3177218Sphk mydir=`cygpath -m $mydir` 3277218Sphk ;; 3377218Sphkesac 3477218Sphkmylib="$mydir/../lib" 3577218Sphk 3677218Sphk# By default, put the jar file and its dependencies on the bootclasspath. 3777218Sphk# This is always required on a Mac, because the system langtools classes 3877218Sphk# are always on the main class path; in addition, it may be required on 3977218Sphk# standard versions of JDK (i.e. using rt.jar and tools.jar) because some 4077218Sphk# langtools interfaces are in rt.jar. 4177218Sphk# Assume that the jar file being invoked lists all the necessary langtools 4277218Sphk# jar files in its Class-Path manifest entry, so there is no need to search 4377218Sphk# dependent jar files for additional dependencies. 4477218Sphk 4577218Sphkif [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then 4677218Sphk cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF | 4777218Sphk grep "Class-Path:" | 4877218Sphk sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1#PS#|g'` 4977218Sphk bcp="$mylib/#PROGRAM#.jar#PS#$cp" 5077218Sphkfi 5177218Sphk 5277218Sphk# tools currently assumes that assertions are enabled in the launcher 5377218Sphkea=-ea:com.sun.tools... 5477218Sphk 5577218Sphk# Any parameters starting with -J are passed to the JVM. 5677218Sphk# All other parameters become parameters of #PROGRAM#. 5777218Sphk 5877218Sphk# Separate out -J* options for the JVM 5977218Sphk# Unset IFS and use newline as arg separator to preserve spaces in args 6077218SphkDUALCASE=1 # for MKS: make case statement case-sensitive (6709498) 6177218SphksaveIFS="$IFS" 6277218Sphknl=' 6377218Sphk' 6477218Sphkfor i in "$@" ; do 6577218Sphk IFS= 6677218Sphk case $i in 6777218Sphk -J* ) javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;; 6877218Sphk * ) toolOpts=$toolOpts$nl$i ;; 6977218Sphk esac 7077218Sphk IFS="$saveIFS" 7177218Sphkdone 7277218Sphkunset DUALCASE 7377218Sphk 7477218SphkIFS=$nl 7577218Sphk"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mylib}/#PROGRAM#.jar" ${toolOpts} 7677218Sphk