Documentation Contents
Java Platform, Standard Edition Troubleshooting Guide
Contents Previous Next

# 8.1 Native Time Zone Information and the JRE

The JRE reads the native time zone information to determine your default time zone. For example, on Windows, the JRE queries the registry to determine the default time zone.

However, the JRE also maintains its own time zone database. This provides cross-platform support because the different operating system APIs are not sufficient to support the Java APIs. The Java time zone database supports time zone IDs and determines daylight saving time rules for all the time zones that the JRE supports. The Java time zone database can be found in <install_dir>`/jre/lib/zi`. The `tzupdater` tool is available to update the Java time zone database.

Modifications to the JRE for each specific operating system are necessary so that the operating system can deliver the system time to the JRE. Then, if a Java application requests the system date by calling date and time related constructors, the system time is returned.

Examples of such constructors are:

`java.util.Date()`
`java.util.GregorianCalendar()`

Constructors related to date and time include:

`System.currentTimeMillis()`
`System.nanoTime()`

Operating system-specific patches might be required to ensure that the correct system time is delivered to the JRE.

The following sections describe troubleshooting techniques for time zone settings.

- Determine the Time Zone Data Version in Use

- Troubleshoot Problems with TZupdater

## 8.1.1 Determine the Time Zone Data Version in Use

The time zone database version that ships in any JRE from Oracle is documented in the Release Notes. However, the actual version can be different from the version mentioned there if the JRE has been patched using the `tzupdater` tool.

To determine the current time zone data version of your JRE either run the `tzupdater` tool with the Version option, or examine the header of the `ZoneInfoMappings` file.

Follow these two steps to determine the time zone data:

- Determine the Time Zone with TZupdater: The Java time zone updater tool is called `tzupdater`. To determine the time zone database version of your JRE, run this tool as follows:

      java -jar tzupdater.jar -V

  Here is a typical output from running the `tzupdater` tool.

      tzupdater version 1.3.33-b01JRE time zone data version: tzdata2010iEmbedded time zone data version: tzdata2010l

  You can download the `tzupdater` tool from this web page: `http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html`

- Examine the ZoneInfoMappings File: Even without the `tzupdater` tool, you can quickly check the version by examining the header of the file <java-home>`/lib/zi/ZoneInfoMappings`. This data is stored in a binary format that is specific to Java. On Oracle Solaris, Linux and Mac OS X operating systems, you can use the octal dump command to see the header of this file.

  Example 8-1 shows the octal dump command format.

  Example 8-1 Octal Dump Command Format

      /usr/bin/od -c -j 11 -N 11 <java-home>/lib/zi/ZoneInfoMappings

  Example 8-2 shows a typical result of such a dump command.

  Example 8-2 Result from Octal Dump Command

      /usr/bin/od -c -j 11 -N 11 /farfaraway/jdks/jdk1.6.0_21/jre/lib/zi/ZoneInfoMappings0000000   t   z   d   a   t   a   2   0   1   0   i0000013

  Example 8-3 shows the time zone data version that is embedded in that JRE is `tzdata2010i`.

  On Microsoft Windows, you can use the `findstr` command to examine the `ZoneInfoMappings` file. Here is an example.

  Example 8-3 Time Zone Data Version Embedded in JRE

      findstr tzdata <java-home>\lib\zi\ZoneInfoMappings

## 8.1.2 Troubleshoot Problems with TZupdater

Sometimes when you run `tzupdater` it quits with the message: There's no tzdata available for this Java runtime. Example 8-4 shows two examples.

Example 8-4 tzupdater Quits with the Message

    $ java -jar tzupdater.jar -Vtzupdater version 1.3.39-b01JRE time zone data version: tzdata2009iThere's no tzdata available for this Java runtime.

    $ java -jar tzupdater.jar -u
    There's no tzdata available for this Java runtime.

The likely cause is that you are using a JRE that is not from Oracle. Oracle provides the JRE for Oracle Solaris (x86, x64, SPARC), Linux (x86, x64, ARM), Microsoft Windows (x86, x64), and Mac OS X (x64). The `java.vendor` property value for these is Sun Microsystems Inc., Oracle Corporation or BEA Systems, Inc. Oracle does not provide the JRE for other platforms.

The output of running the `java -version` command does not provide enough information to determine the actual vendor of a JRE. However, running `tzupdater` in update mode with the `-v` option does print out the `java.vendor` property. Example 8-5 shows attempting to run tzupdater when the environment is HP_UX from Hewlett Packard.

Example 8-5 Run tzupdater in HP_UX Environment

    root@my_server:/opt/java6/bin> uname -a
    HP-UX my_server B.11.23 U ia64 1114591084 unlimited-user license
    root@my_server:/opt/java6/bin> ./java -version
    java version "1.6.0.05"
    Java(TM) SE Runtime Environment (build 1.6.0.05-jinteg_14_oct_2009_01_44-b00)
    Java HotSpot(TM) Server VM (build 14.2-b01-jre1.6.0.05-rc5, mixed mode)
    root@my_server:/opt/java6/bin> ./java -jar tzupdater.jar -v -u
    java.home: /opt/java6/jre
    java.vendor: Hewlett-Packard Co.
    java.version: 1.6.0.05
    JRE time zone data version: tzdata2009i
    There's no tzdata available for this Java runtime.

In Example 8-5, `java.vendor` is set to Hewlett-Packard Co. The JRE that you are trying to update using `tzupdater` is not supported by Oracle.

A possible solution is visit the website of your JRE vendor and determine whether a time zone updater tool is available. For example, see the Hewlett-Packard version of tzupdater tool.

Contents Previous Next

Copyright © 1993, 2018, Oracle and/or its affiliates. All rights reserved.
Contact Us