Change time zone for tomcat [duplicate]

孤者浪人 提交于 2019-12-10 21:00:48

问题


I have downloaded Tomcat 8 and copied the unzipped folder in my required path. I am using this tomcat as my server while running my web app.

  1. When I access system default time zone using java time package, actually the time zone of what I get. Is it system's clock setting? Or is it tomcat's settings.

  2. Where can I set time zone in tomcat.


回答1:


  1. Tomcat uses OS time settings.
  2. Best place is to set environment variables is setenv.bat (setenv.sh) in tomcat bin directory. Use set JAVA_OPTS="-Duser.timezone=GMT" for windows or export JAVA_OPTS="-Duser.timezone=GMT" for linux. Also make sure that catalina.sh contains script to call setenv file. It should be there by default.


来源:https://stackoverflow.com/questions/34715451/change-time-zone-for-tomcat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!