[CentOS] Java not seeing timezone/tomcat displaying times in GMT

Jeff Larsen jlar310 at gmail.com
Fri Feb 8 16:46:16 UTC 2008


On Feb 7, 2008 9:12 PM, Isaac Gonzalez <igonzalez at autoreturn.com> wrote:
> Any ideas how to force tomcat to display directory listing in local time
> zone format of my cent box instead of GMT.
>
>
> I tried all suggestions here:
> http://marvinlee.wordpress.com/2008/02/01/java-timezone-setting-in-cento
> s-for-asiakuala_lumpur/
>
> except I use PST8PDT for the timezone....i believe I'm using this as my
> timezone as this is what appears in /etc/localtime file. When using date
> command it displays in correct format from bash prompt.

I don't know exactly what PST8PDT is, but Java prefers the full names
for time zones like US/Central or US/Pacific

Have you tried something like -Duser.timezone=US/Pacific on the java
command line that launches tomcat. You can add that to JAVA_OPTS in
$CATALINA_HOME/bin/setenv.sh

Is your tzdata package in CentOS up to date?

Then again, I haven't done much with directory listings in Tomcat, so
there may be a different issue at work here. Can you create a simple
JSP page that writes java.util.TimeZone.getDefault().toString() and
see what you get?

--
Jeff



More information about the CentOS mailing list