问题
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.
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.
Where can I set time zone in tomcat.
回答1:
- Tomcat uses OS time settings.
- 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 orexport 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