From: Kevin J. B. <jyt...@sa...> - 2003-04-04 17:03:55
|
> > >From: Oti <oh...@ya...> >[ Curtis Brown ] > > >>I want to pass arguments to the java VM when I run jython, for >>example >>-mx1000m. Is there a good way to do this other than writing my own >>shell script equivalent jython of that prepends the args to the java >>command line? >> >> > >Probably - AFAIK - not. I suggest writing your own jython (or java) >starter script, where you can set all of your VM args. > I've wanted this functionality before, too, but have always just modified the existing scripts. :-) But we should probably make jython & jython.bat allow it, how about the following (if no one objects, I'll check it in to the scripts in CVS and the installer/ templates): ---- jython.bat (ignore the specific file paths): java %JVM_ARGS% "-Dpython.home=w:/tools/jython" -classpath "w:\tools\jython\jython.jar;%CLASSPATH%" org.python.util.jython %ARGS% --- jython (ignore specific file paths): java $JVM_ARGS -Dpython.home="$CP_ROOT_SRC/tools/jython" -classpath "$CP_ROOT_SRC/tools/jython/jython.jar;$CLASSPATH" "org.python.util.jython" "$@" This lets you do the following: $ export JVM_ARGS="-Dp1=1 -Xms1000m -Xmx1000m" $ ./jython Jython 2.1 on java1.3.1_05 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import java >>> java.lang.Runtime.getRuntime().totalMemory() 1048313856L >>> You can also write this as: JVM_ARGS="-Dp1=1 -Xms1000m -Xmx1000m" ./jython And it works similarly in Windows shell:: >set JVM_ARGS=-Dp1=1 -Xms1000m -Xmx1000m set JVM_ARGS=-Dp1=1 -Xms1000m -Xmx1000m >jython Jython 2.1 on java1.4.1 (JIT: null) Type "copyright", "credits" or "license" for more information. >>> import java >>> java.lang.Runtime.getRuntime().totalMemory() 1040515072L >>> (Yes, you can do getProperty( "p1" ) as well...) Fair enough? kb |