by Fábio Souza
Timezone, when using Java, can be something tricky. You can get surprised when you change your OS timezone (something common to countries with DST) and it doesn't take any effect on your Java programs. What does Sun have to say about that? It can be found at their FAQ:
Do my operating system's timezone patches fix the Java platform's timezone data?
No. The Java SE platform's timezone data is not read from the local or host operating system. The Java SE platform maintains a private repository of timezone data in locally installed files (.../jre/lib/zi) as part of the Java Runtime Environment (JRE) software. Applying whatever operating system timezone patches (for example Solaris OS, Linux, Windows) will have no effect on the accuracy of the Java SE platform's timezone data.
java -jar tzupdater.jar -u (don't forget to check if you have read/write access to Java's directory structure)
We are ok about Sun's JVM... But the solution is the same to all JVMs? Not really =), but it is very similar to IBM JVM and Oracle JRockit. In all cases we either have to download a program and execute it to update the installed JVM or wait for the next JVM update release.
Here are some useful links:
Sun:
- About Java and Timezone
- Timezone Data Versions in the JRE Software
- Sun's tzupdater download
- Sun's tzupdater guide
- Sun's FAQ
IBM (thanks to my friend and co-worker Frederico Hakamine):
Oracle:
- Oracle JRockit's tzupdater download (this is the JRockit's download page. You can find the tzupdater there)
- Oracle JRockit's tzupdater guide