langtools/src/share/bin/launcher.sh-template
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 10 06bc494ca11e
child 3149 0cd06d598d6f
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
#!/bin/sh
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
# Copyright 2006-2007 Sun Microsystems, Inc.  All Rights Reserved.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
#
06bc494ca11e Initial load
duke
parents:
diff changeset
     7
# This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
# under the terms of the GNU General Public License version 2 only, as
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
# published by the Free Software Foundation.  Sun designates this
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
# particular file as subject to the "Classpath" exception as provided
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
# by Sun in the LICENSE file that accompanied this code.
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
# This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
# version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
# accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
# You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
# 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
# CA 95054 USA or visit www.sun.com if you need additional information or
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
# have any questions.
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
#
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
mydir="`dirname $0`"
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
mylib="`dirname $mydir`"/lib
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
# By default, put the jar file and its dependencies on the bootclasspath.
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
# This is always required on a Mac, because the system langtools classes
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
# are always on the main class path; in addition, it may be required on
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
# standard versions of JDK (i.e. using rt.jar and tools.jar) because some
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
# langtools interfaces are in rt.jar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
# Assume that the jar file being invoked lists all the necessary langtools
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
# jar files in its Class-Path manifest entry, so there is no need to search
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
# dependent jar files for additional dependencies.
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
if [ "$LANGTOOLS_USE_BOOTCLASSPATH" != "no" ]; then
06bc494ca11e Initial load
duke
parents:
diff changeset
    41
   cp=`unzip -c $mylib/#PROGRAM#.jar META-INF/MANIFEST.MF |
06bc494ca11e Initial load
duke
parents:
diff changeset
    42
       grep "Class-Path:" |
06bc494ca11e Initial load
duke
parents:
diff changeset
    43
       sed -e 's|Class-Path: *||' -e 's|\([a-z]*\.jar\) *|'"$mylib"'/\1:|g'`
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
   bcp="$mylib/#PROGRAM#.jar":$cp 
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
fi
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
# javac currently assumes that assertions are enabled in the launcher
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
ea=-ea:com.sun.tools
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
"#TARGET_JAVA#" ${bcp:+-Xbootclasspath/p:"$bcp"} ${ea} -jar "${mydir}"/../lib/#PROGRAM#.jar "$@"