src/share/bin/launcher.sh-template

Thu, 29 Apr 2010 14:25:47 -0700

author
jjg
date
Thu, 29 Apr 2010 14:25:47 -0700
changeset 548
32675c68a3ca
parent 471
2d0f4e7b44b2
child 554
9d9f26857129
permissions
-rw-r--r--

6948251: need to quote args in langtools launcher script
Reviewed-by: darcy

duke@1 1 #!/bin/sh
duke@1 2
duke@1 3 #
jjg@308 4 # Copyright 2006-2009 Sun Microsystems, Inc. All Rights Reserved.
duke@1 5 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@1 6 #
duke@1 7 # This code is free software; you can redistribute it and/or modify it
duke@1 8 # under the terms of the GNU General Public License version 2 only, as
duke@1 9 # published by the Free Software Foundation. Sun designates this
duke@1 10 # particular file as subject to the "Classpath" exception as provided
duke@1 11 # by Sun in the LICENSE file that accompanied this code.
duke@1 12 #
duke@1 13 # This code is distributed in the hope that it will be useful, but WITHOUT
duke@1 14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@1 15 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@1 16 # version 2 for more details (a copy is included in the LICENSE file that
duke@1 17 # accompanied this code).
duke@1 18 #
duke@1 19 # You should have received a copy of the GNU General Public License version
duke@1 20 # 2 along with this work; if not, write to the Free Software Foundation,
duke@1 21 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@1 22 #
duke@1 23 # Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
duke@1 24 # CA 95054 USA or visit www.sun.com if you need additional information or
duke@1 25 # have any questions.
duke@1 26 #
duke@1 27
duke@1 28 mydir="`dirname $0`"
duke@1 29 mylib="`dirname $mydir`"/lib
duke@1 30
duke@1 31 # By default, put the jar file and its dependencies on the bootclasspath.
duke@1 32 # This is always required on a Mac, because the system langtools classes
duke@1 33 # are always on the main class path; in addition, it may be required on
duke@1 34 # standard versions of JDK (i.e. using rt.jar and tools.jar) because some
duke@1 35 # langtools interfaces are in rt.jar.
duke@1 36 # Assume that the jar file being invoked lists all the necessary langtools
duke@1 37 # jar files in its Class-Path manifest entry, so there is no need to search
duke@1 38 # dependent jar files for additional dependencies.
duke@1 39
duke@1 40 if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
jjg@471 41 cp=`unzip -c "$mylib/#PROGRAM#.jar" META-INF/MANIFEST.MF |
duke@1 42 grep "Class-Path:" |
duke@1 43 sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1:|g'`
duke@1 44 bcp="$mylib/#PROGRAM#.jar":$cp
duke@1 45 fi
duke@1 46
jjg@308 47 # tools currently assumes that assertions are enabled in the launcher
jjg@370 48 ea=-ea:com.sun.tools...
duke@1 49
jjg@308 50 # Any parameters starting with -J are passed to the JVM.
jjg@308 51 # All other parameters become parameters of #PROGRAM#.
jjg@308 52
jjg@308 53 # Separate out -J* options for the JVM
jjg@308 54 # Unset IFS and use newline as arg separator to preserve spaces in args
jjg@308 55 DUALCASE=1 # for MKS: make case statement case-sensitive (6709498)
jjg@308 56 saveIFS="$IFS"
jjg@308 57 nl='
jjg@308 58 '
jjg@308 59 for i in "$@" ; do
jjg@308 60 IFS=
jjg@308 61 case $i in
jjg@308 62 -J* ) javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
jjg@308 63 * ) toolOpts=$toolOpts$nl$i ;;
jjg@308 64 esac
jjg@308 65 IFS="$saveIFS"
jjg@308 66 done
jjg@308 67 unset DUALCASE
jjg@308 68
jjg@548 69 IFS=$nl
jjg@548 70 "#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mydir}"/../lib/#PROGRAM#.jar ${toolOpts}

mercurial