Setting default timezone for the JVM of Tomcat

On Linux/Unix: add the "-Duser.timezone=Europe/Budapest" parameter (replacing the "Europe/Budapest" part with the ID of your timezone) to the JAVA_OPTS environment variable in your {TOMCAT_HOME}/bin/startup.sh. If you don't have a line in your startup.sh for setting the JAVA_OPTS, then you can add this to the start of the file (after the shell-specification in the first line of the shell-script, of course Wink ):
export JAVA_OPTS="-Duser.timezone=Europe/Budapest"

On Windows: start the "Configure Tomcat" program from the Start Menu, select the Java tab and add the "-Duser.timezone=Europe/Budapest" to the Java options list.

On both platforms you'll have to restart Tomcat for the new default timezone setting to take effect.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Default timezone setting not take effort.

Hi,

The below timezone setting not take effort even after twice restart the tomcat service.
Start the "Configure Tomcat" program from the Start Menu, select the Java tab and add the "-Duser.timezone=Asia/Singapore" to the Java options list.

Re: Default timezone setting not take effort

That's strange. Unfortunately I cannot tell you why it doesn't take effect. Imho it should. Shock If you can figure it out on your own, please leave a comment about it so others can get a clue on a possible pitfall.

Timezone setting

My issue for the timezone setting is resolved after I added the env variable as suggested. Our env is Linux and the file setenv.sh is the one that I updated in /tomcat/bin dir
JAVA_OPTS=-Duser.timezone=CST6CDT
export JAVA_OPTS

Then I stopped and restarted the Tomcat.
The variable took effect and my issue is resolved.

Syndicate content