src/share/bin/launcher.sh-template
author ohair
Wed Dec 22 20:12:27 2010 -0800 (2 years ago)
changeset 112 38d07d25ab65
parent 86d5ba92698ff5
permissions -rw-r--r--
6962318: Update copyright year
Reviewed-by: andrew
duke@0
#!/bin/sh
duke@0
duke@0
#
ohair@112
# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
duke@0
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@0
#
duke@0
# This code is free software; you can redistribute it and/or modify it
duke@0
# under the terms of the GNU General Public License version 2 only, as
ohair@86
# published by the Free Software Foundation.  Oracle designates this
duke@0
# particular file as subject to the "Classpath" exception as provided
ohair@86
# by Oracle in the LICENSE file that accompanied this code.
duke@0
#
duke@0
# This code is distributed in the hope that it will be useful, but WITHOUT
duke@0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@0
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
duke@0
# version 2 for more details (a copy is included in the LICENSE file that
duke@0
# accompanied this code).
duke@0
#
duke@0
# You should have received a copy of the GNU General Public License version
duke@0
# 2 along with this work; if not, write to the Free Software Foundation,
duke@0
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@0
#
ohair@86
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@86
# or visit www.oracle.com if you need additional information or have any
ohair@86
# questions.
duke@0
#
duke@0
duke@0
mydir="`dirname $0`"
duke@0
mylib="`dirname $mydir`"/lib
duke@0
duke@0
# By default, put the jar file and its dependencies on the bootclasspath.
duke@0
# This is always required on a Mac, because the system langtools classes
duke@0
# are always on the main class path; in addition, it may be required on
duke@0
# standard versions of JDK (i.e. using rt.jar and tools.jar) because some
duke@0
# langtools interfaces are in rt.jar.
duke@0
# Assume that the jar file being invoked lists all the necessary langtools
duke@0
# jar files in its Class-Path manifest entry, so there is no need to search
duke@0
# dependent jar files for additional dependencies.
duke@0
duke@0
if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
jjg@82
   cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF |
duke@0
       grep "Class-Path:" |
duke@0
       sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1:|g'`
duke@0
   bcp="$mylib/#PROGRAM#.jar":$cp 
duke@0
fi
duke@0
jjg@50
# tools currently assumes that assertions are enabled in the launcher
jjg@50
ea=-ea:com.sun.tools...
duke@0
jjg@50
# Any parameters starting with -J are passed to the JVM.
jjg@50
# All other parameters become parameters of #PROGRAM#.
jjg@50
jjg@50
# Separate out -J* options for the JVM
jjg@50
# Unset IFS and use newline as arg separator to preserve spaces in args
jjg@50
DUALCASE=1  # for MKS: make case statement case-sensitive (6709498)
jjg@50
saveIFS="$IFS"
jjg@50
nl='
jjg@50
'
jjg@50
for i in "$@" ; do
jjg@50
   IFS=
jjg@50
   case $i in
jjg@50
   -J* )       javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
jjg@50
   *   )       toolOpts=$toolOpts$nl$i ;;
jjg@50
   esac
jjg@50
   IFS="$saveIFS"
jjg@50
done
jjg@50
unset DUALCASE
jjg@50
jjg@83
IFS=$nl
jjg@83
"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mydir}"/../lib/#PROGRAM#.jar ${toolOpts}