src/share/bin/launcher.sh-template

Tue, 21 Dec 2010 16:29:10 -0800

author
jjh
date
Tue, 21 Dec 2010 16:29:10 -0800
changeset 805
7c33098600b2
parent 656
6ef801fa38b7
child 871
bfa59f3e84bd
permissions
-rw-r--r--

7008378: javac bootstrap launcher fails on cygwin when called via an absolute path
Summary: Use cygpath if it is cygwin
Reviewed-by: ksrini

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

mercurial