We've kicked this around for a while, and I think we need to get it in
for 1.0:
jruby -J-Xmx1024M -J-server run_my_script.rb
The -J option passes whatever's after it as an argument to the
underlying JVM. I've attached a patch (about to be committed) that does
it for the shell script, but I don't know how to do it in cmd scripts
(Windows).
- Charlie
Index: src/org/jruby/Main.java
===================================================================
--- src/org/jruby/Main.java (revision 3596)
+++ src/org/jruby/Main.java (working copy)
@@ -153,6 +153,7 @@
out.println(" -d set debugging flags (set $DEBUG
to true)");
out.println(" -v print version number, then turn
on verbose mode");
out.println(" -O run with ObjectSpace disabled
(improves performance)");
+ out.println(" -J<option> pass <option> to the underlying
JVM");
out.println(" -S cmd run the specified command in
JRuby's bin dir");
out.println(" -C pre-compile scripts before
running (EXPERIMENTAL)");
out.println(" -y read a YARV-compiled Ruby script
and run that (EXPERIMENTAL)");
Index: bin/jruby
===================================================================
--- bin/jruby (revision 3596)
+++ bin/jruby (working copy)
@@ -105,24 +105,22 @@
JRUBY_BASE="$JRUBY_HOME"
fi
-# ----- Execute The Requested Command -----------------------------------------
+# ----- Parse additional java arguments ------------------------------------
-DEBUG=""
-if [ "$1" = "JAVA_DEBUG" ]; then
- DEBUG="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y"
- shift
-else
- if [ "$1" = "JPROFILER" ]; then
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPROFILER_PATH/bin/linux-x86
- DEBUG="-Xrunjprofiler:port=8000,noexit
-Xbootclasspath/a:/$JPROFILER_PATH/bin/agent.jar"
+parse_args() {
+while [ $# -gt 0 ] ; do
+ case "$1" in
+ -J*) jopt=`expr "X-$1" : 'X--J\(.*\)'`; jargs="$jargs $jopt";;
+ *) args="$args $1" ;;
+ esac
shift
- else if [ "$1" = "HPROF" ]; then
- DEBUG="-Xrunhprof:cpu=samples"
- shift
- fi
- fi
-fi
+done
+} # parse_args()
+parse_args "$@"
+
+# ----- Execute The Requested Command -----------------------------------------
+
if $cygwin; then
JAVA_HOME=`cygpath --mixed "$JAVA_HOME"`
JRUBY_BASE=`cygpath --mixed "$JRUBY_BASE"`
@@ -136,14 +134,9 @@
shift
fi
-if [ "$1" = "SERVER" ]; then
- DEBUG="-server"
- shift
-fi
-
-exec "$JAVA_CMD" $JAVA_OPTS $DEBUG -Xmx256m -Xss1024k -da -classpath "$CP"
\
+exec "$JAVA_CMD" -Xmx256m -Xss1024k -da $jargs $JAVA_OPTS -classpath "$CP"
\
"-Djruby.base=$JRUBY_BASE" "-Djruby.home=$JRUBY_HOME"
\
"-Djruby.lib=$JRUBY_BASE/lib" -Djruby.script=jruby
\
"-Djruby.shell=$JRUBY_SHELL" $EN_US
\
- org.jruby.Main $JRUBY_OPTS "$@"
+ org.jruby.Main $JRUBY_OPTS $args
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email