How do I update the timezone information for the OpenJDK? Oracle puts out tzupdater but that is bound by their license so I don't want to use it. I'm looking for an open source alternative that will allow me to just update the timezone information and not the entire JRE.
Asked
Active
Viewed 9,214 times
14
-
Using tzupdater is the only way, can you please clarify your license issue? – Meno Hochschild Mar 17 '15 at 15:51
-
The Oracle license for the JRE is not open source. The license for the tzupdater is not a common / standard open source license so I'm leery of using it without legal guidance (expensive). – MonkBen Mar 17 '15 at 16:35
-
Thanks for clarification. You are right. I even read something about accepting US export laws in this license. – Meno Hochschild Mar 17 '15 at 17:28
-
Updating the timezone repository in Java-8 effectively means the exchange of the tzdb.dat-file in directory {JAVA_HOME}/jre/lib to a newer version. – Meno Hochschild Mar 17 '15 at 17:35
-
Right. That is essentially what I want to do. Just not sure how... – MonkBen Mar 23 '15 at 20:42
-
@MonkBen Please share if you found a way to update timezone in OpenJDK. I am trying the same. Thanks. – Anjana Jun 05 '17 at 11:00
-
Nope never figured it out. Please comment if you do. I think we just used a newer JRE version. – MonkBen Jun 07 '17 at 01:47
-
see https://stackoverflow.com/a/44741369/1054140 – Sergey Grinev Jun 24 '17 at 22:09
1 Answers
15
Azul recently published an open source tool to update TZ data: https://www.azul.com/products/open-source-tools/ziupdater-time-zone-tool/
It works similar to Oracle tzupdater, but has open source (GPLv2 License) license.
Usage: apply it to IANA data package using Java which you want to update:
$JAVA_HOME/bin/java -jar ziupdater.jar -l file://[path]/tzdata.tar.gz
By this command you will apply changes to timezone to your Java installation.
What does it mean?
Consider next situation: you installed Java a year ago and later a government of certain country changed their laws, e.g. cancelled DST. Your Java installation doesn't know about that yet and may handle time incorrectly for that particular region. Updating timezone data solves that.

Sergey Grinev
- 34,078
- 10
- 128
- 141
-
3Great information. But I suggest replacing that word “locale”. I understand what you mean, but it could be confused with [`Locale`](https://docs.oracle.com/javase/8/docs/api/java/util/Locale.html) which has *nothing* to do with time zone, completely orthogonal, yet is involved in date-time work because of localizing the textual `String` representations of date-time values. Conflating time zone and locale is a common source of confusion among programmers learning to do date-time work. I suggest replacing “for the locale of that particular country” with something like “for a particular region”. – Basil Bourque Jun 27 '17 at 05:22
-
1
-
-
https://github.com/akashche/tzdbgen is fork of part of OpenJDK https://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/make/src/classes/build/tools/tzdb/ – muyinliu Jun 07 '19 at 05:49