cPanel — Configuring JVM Options and System Variables via Tomcat Print

  • cpanel, java
  • 131

How to Configure JVM Options and System Variables in cPanel

On Systron cPanel servers equipped with Java/Tomcat hosting support, custom JVM options and environmental variables are handled by updating your account's shell profile configurations or editing your custom application deployment context files.

Method 1: Setting Global JVM Variables via Shell Profile

If you have SSH terminal access enabled on your account, you can pass custom memory limits (like -Xmx) directly to your user-level server instance wrapper:

  • Log in to your account via SSH using your cPanel system credentials.
  • Open your terminal profile configuration file using a command-line editor:
    nano ~/.bashrc
  • Scroll to the bottom of the file and export your custom arguments into the CATALINA_OPTS system variable:
    export CATALINA_OPTS="-Xms256m -Xmx1024m -Dspring.profiles.active=production"
  • Save the file (Press Ctrl+O, then Ctrl+X) and reload your shell environment:
    source ~/.bashrc

Method 2: Configuring Properties in the Context XML File

If you prefer a graphic configuration workflow or want properties restricted strictly to a specific application context, you can define them in the deployment files:

  • Open your cPanel File Manager and navigate inside the conf directory of your application setup.
  • Locate and edit your application's context.xml configuration file.
  • Add your environment entries directly inside the primary <Context> tags block:
    <Environment name="myCustomProperty" value="production" type="java.lang.String" override="false"/>
  • Save the changes and use the cPanel Java/Tomcat tool UI to Restart your application runner.

Was this answer helpful?

« Back