--- a/langtools/src/share/bin/launcher.sh-template Fri Jun 26 12:22:40 2009 -0700
+++ b/langtools/src/share/bin/launcher.sh-template Fri Jun 26 18:51:39 2009 -0700
@@ -1,7 +1,7 @@
#!/bin/sh
#
-# Copyright 2006-2007 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 2006-2009 Sun Microsystems, Inc. All Rights Reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,27 @@
bcp="$mylib/#PROGRAM#.jar":$cp
fi
-# javac currently assumes that assertions are enabled in the launcher
+# tools currently assumes that assertions are enabled in the launcher
ea=-ea:com.sun.tools
-"#TARGET_JAVA#" ${bcp:+-Xbootclasspath/p:"$bcp"} ${ea} -jar "${mydir}"/../lib/#PROGRAM#.jar "$@"
+# Any parameters starting with -J are passed to the JVM.
+# All other parameters become parameters of #PROGRAM#.
+
+# Separate out -J* options for the JVM
+# Note jdk as possible default to run jtreg
+# Unset IFS and use newline as arg separator to preserve spaces in args
+DUALCASE=1 # for MKS: make case statement case-sensitive (6709498)
+saveIFS="$IFS"
+nl='
+'
+for i in "$@" ; do
+ IFS=
+ case $i in
+ -J* ) javaOpts=$javaOpts$nl`echo $i | sed -e 's/^-J//'` ;;
+ * ) toolOpts=$toolOpts$nl$i ;;
+ esac
+ IFS="$saveIFS"
+done
+unset DUALCASE
+
+eval "#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mydir}"/../lib/#PROGRAM#.jar ${toolOpts}