Mercurial > hg > release > thermostat-1.0
changeset 374:8195e4d2ff18
Allow jvm arguments
reviewed-by: omajid
review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-June/001829.html
author | Mario Torre <neugens.limasoftware@gmail.com> |
---|---|
date | Wed, 13 Jun 2012 21:33:48 +0200 |
parents | e4beb95382b6 |
children | 8b0c224f1d88 |
files | README distribution/scripts/thermostat |
diffstat | 2 files changed, 62 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/README Wed Jun 13 10:33:37 2012 -0400 +++ b/README Wed Jun 13 21:33:48 2012 +0200 @@ -1,6 +1,16 @@ Thank you for downloading Thermostat. -REQUIREMENTS: +This document contains the following information useful to compile and run +Thermostat: + +1. REQUIREMENTS +2. BUILDING THERMOSTAT +3. RUNNING THERMOSTAT +4. PASSING JVM SPECIFIC OPTIONS + + +-------------------------------------------------------------------------------- +REQUIREMENTS OpenJDK7 Thermostat requires at least Java 7 to build and run. Thermostat has been tested @@ -13,7 +23,9 @@ Either a /etc/os-release file or lsb_release -BUILDING THERMOSTAT: + +-------------------------------------------------------------------------------- +BUILDING THERMOSTAT 1. Run "mvn clean package". All tests should pass and the build should succeed. Requires a graphical environment for the ui tests. @@ -29,7 +41,9 @@ 2. The resultant Thermostat system can now be found under the directory distribution/target. -RUNNING THERMOSTAT: + +-------------------------------------------------------------------------------- +RUNNING THERMOSTAT 0. cd into distribution/target directory just created @@ -41,3 +55,21 @@ 3. To start the cli client: bin/thermostat [--help] + + +-------------------------------------------------------------------------------- +PASSING JVM SPECIFIC OPTIONS + +In some cases, it may be desirable to pass arguments to the virtual machine, +for example to increase memory or change the look and feel for the Swing Client. + +Thermostat follows a well established convention to enable this: options that +start with -J are not passed to the thermostat launcher, but instead to the +JVM itself. + +For example, this command launches thermostat with the Nimbus Look and Feel, +rather then the default one: + +bin/thermostat gui \ + -J-Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel +
--- a/distribution/scripts/thermostat Wed Jun 13 10:33:37 2012 -0400 +++ b/distribution/scripts/thermostat Wed Jun 13 21:33:48 2012 +0200 @@ -46,6 +46,7 @@ export THERMOSTAT_HOME THERMOSTAT_LIBS="${THERMOSTAT_HOME}/libs" +# all the various libraries we need, mainly external dependencies JCOMMON_JAR="${THERMOSTAT_LIBS}/jcommon.jar" MONGO_JAR="${THERMOSTAT_LIBS}/mongo.jar" BSON_JAR="${THERMOSTAT_LIBS}/bson.jar" @@ -53,7 +54,7 @@ TOOLS_JAR="@java.home@/../lib/tools.jar" NETTY_JAR="${THERMOSTAT_LIBS}/netty-3.2.4.Final.jar" -#SERVICE_CLASSPATH="${JCOMMON_JAR}:${MONGO_JAR}:${BSON_JAR}:${TOOLS_JAR}:${JOPT_JAR}:${NETTY_JAR}" +# plus the main services we use and export SERVICE_CLASSPATH="${THERMOSTAT_LIBS}/*" THERM_DIR=${THERMOSTAT_LIBS} @@ -61,5 +62,29 @@ SERVICE_CLASSPATH="${TOOLS_JAR}:${SERVICE_CLASSPATH}:${THERM_DIR}/thermostat-agent-@project.version@.jar:${THERM_DIR}/thermostat-common-@project.version@.jar:${THERM_DIR}/thermostat-tools-@project.version@.jar" THERMOSTAT_MAIN="com.redhat.thermostat.launcher.Thermostat" -${JAVA} -cp ${SERVICE_CLASSPATH} ${THERMOSTAT_MAIN} "$@" +# start parsing arguments, we intercept jvm arguments vs thermostat specific +# arguments +JAVA_ARGS=() +ARGS=() + +i=0 +j=0 + +while [ "$#" -gt "0" ]; +do + case "$1" in + -J*) + JAVA_ARGS[$i]="${1##-J}" + i=$((i+1)) + ;; + *) + ARGS[$j]="$1" + j=$((j+1)) + ;; + esac + shift +done + +# finally run thermostat +${JAVA} "${JAVA_ARGS[@]}" -cp ${SERVICE_CLASSPATH} ${THERMOSTAT_MAIN} "${ARGS[@]}" exit $?