Introduction
In a number of situations it is recommended or required to set Java options to specify the behavior of the JVM.
- Recommendations: JS7 - FAQ - Which Java Options are recommended?
- Troubleshooting: JS7 - Troubleshooting - Connection reset or Timeout reached (30s) for process and other articles.
Java options are set individually for the respective JS7 components, the Controller, Agent and JOC Cockpit.
Specify Java Options for a Controller or Agent
The below examples make use of the -Xms128m -Xmx500m
Java options that are used to specify heap memory requirements.
Do not feel tempted to apply the values from the below examples that are used for explanation purposes only.
Unix Operating Systems
For Unix, the JAVA_OPTIONS
environment variable can be set before running the Controller or Agent start script like this:
From the Unix command line or from the Controller instance start script
controller_<instance>.sh
:Unix example to run the Controller start script with Java options# Set Java options before running the Controller start script export JAVA_OPTIONS="-Xms128m -Xmx500m" ./controller.sh start # Alternatively set Java options when running the Controller start script ./controller.sh start --java-options="-Xms128m -Xmx500m" # For use with a Controller daemon add this line to the Controller instance start script controller_<instance>.sh export JAVA_OPTIONS="-Xms128m -Xmx500m"
From the Unix command line or from the Agent instance start script
agent_4445.sh
(assuming that port4445
is used for the Agent):Unix example to run the Agent start script with Java options# Set Java options before running the Agent start script export JAVA_OPTIONS="-Xms128m -Xmx500m" ./agent.sh start # Alternatively set Java options when running the Agent start script ./agent.sh start --java-options="-Xms128m -Xmx500m" # For use with an Agent daemon add this line to the Agent instance start script agent_<port>.sh export JAVA_OPTIONS="-Xms128m -Xmx500m"
- Alternatively the
JAVA_OPTIONS
environment variable can be set with- the profile (
~/.bashrc
,~/.bash_profile
etc.) of the run-time account used for Controller or Agent, - the JS7 - systemd Service Files for automated Startup / Shutdown with Unix Systems.
- the profile (
Windows Operating Systems
For Windows, the JAVA_OPTIONS
environment variable can be set before running the Controller or Agent start script like this:
From the Windows command line or from the Controller instance start script
controller_<instance>.cmd
:Windows example to run the Controller start script with Java options@rem Set Java options before running the Controller start script set JAVA_OPTIONS="-Xms128m -Xmx500m" .\controller.cmd start @rem Alternatively set Java options when running the Controller start script .\controller.cmd start --java-options="-Xms128m -Xmx500m" @rem For use with a Controller Windows Service add this line to the Controller instance start script controller_<instance>.cmd set JAVA_OPTIONS="-Xms128m -Xmx500m"
From the Windows command line or from the Agent instance start script
agent_4445.cmd
(assuming that port4445
is used for the Agent):Windows example to run the Agent instance start script with Java options@rem Set Java options before running the Agent start script from the command line set JAVA_OPTIONS="-Xms128m -Xmx500m" .\agent.cmd start @rem Alternatively set Java options when running the Agent start script .\agent.cmd start --java-options="-Xms128m -Xmx500m" @rem For use with an Agent Windows Service add this line to the Agent instance start script agent_<port>.cmd set JAVA_OPTIONS="-Xms128m -Xmx500m"
- Alternatively, when operating the Controller or Agent as a Windows Service then from the .
\service
directory of the installation run- for a Controller:
js7_controller_<controller-id>w.exe
- where
<controller-id>
corresponds to the Controller ID the Controller has been installed for. - Example:
C:\Program Files\sos-berlin.com\js7\controller\my-controller\service\js7_controller_mycontrollerw.exe
- where
- for an Agent:
js7_agent_<port>w.exe
- where
<port>
corresponds to the port that the Agent is operated for. - Example:
C:\Program Files\sos-berlin.com\js7\agent_4445\service\js7_agent_4445w.exe
- where
- This brings up a utility that allows Java options to be specified:
- Note: The Controller or Agent Windows Service has to be restarted to apply changes to Java options.
- for a Controller:
Specify Java Options for JOC Cockpit
The below examples make use of the -Xms128m -Xmx500m
Java options that are used to specify heap memory requirements.
Do not feel tempted to apply the values from the below examples that are used for explanation purposes only.
Unix Operating Systems
For Unix the JAVA_OPTIONS
environment variable can be set before running the Jetty start script like this:
The Jetty start script is available from the installation directory
/opt/sos-berlin.com/js7/joc/jetty/bin/jetty.sh
or a location specified during installation:Unix example to run the Jetty start script with Java options# Set Java options before running the Jetty start script export JAVA_OPTIONS="-Xms128m -Xmx500m" ./jetty.sh start
When running JOC Cockpit as a daemon then the following line can be added to the
$HOME/.jocrc
file of the JOC Cockpit run-time account. This file is created by the installer, it is used if it exists and is executable. The$HOME
directory is identified from the/etc/passwd
file during installation.Unix example to use $HOME/.jocrc with Java optionsexport JAVA_OPTIONS="-Xms128m -Xmx500m"
When running JOC Cockpit as a daemon then the
/etc/default/joc
file can be created (requires root permission) by the user. This file is not created by the installer, it will be used if it exists and is executable. This file will not be used if the$HOME/.jocrc
file is present, see above.Unix example to use /etc/default/joc with Java optionsexport JAVA_OPTIONS="-Xms128m -Xmx500m"
- Alternatively the
JAVA_OPTIONS
environment variable can be set with- the profile (
~/.bashrc
,~/.bash_profile
etc.) of the run-time account used for JOC Cockpit, - the JS7 - systemd Service Files for automated Startup / Shutdown with Unix Systems.
- the profile (
Windows Operating Systems
For Windows, the JAVA_OPTIONS
environment variable can be set before running the JOC Cockpit start script like this:
Only when JOC Cockpit is not installed as Windows Service then the start script
C:\Program Files\sos-berlin.com\js7\joc\jetty\bin\jetty.cmd
is available.Windows example to run the JOC Cockpit start script with Java options@rem Set Java options before running the JOC Cockpit start script set JAVA_OPTIONS="-Xms128m -Xmx500m" .\jetty.cmd start
- When operating the JOC Cockpit as a Windows Service then from the .
\service
directory of the installation run- for JOC Cockpit:
js7_jocw.exe
- Example:
C:\Program Files\sos-berlin.com\js7\joc\service\js7_jocw.exe
- Example:
- This brings up a utility that allows Java options to be specified:
- Note: The JOC Cockpit Windows Service has to be restarted to apply changes to Java options.
- for JOC Cockpit: