Java Daylight Saving Time - (Daylight Saving Time)

Asked

Viewed 3,702 times

0

We changed the entry time of summer time 2018 on the Operating System (Linux or Windows), but the JAVA application shows the wrong time (daylight saving time).

  • Java keeps this information within the JVM itself, separate from the operating system. To update, you can use the Tzupdater Tool: https://www.oracle.com/technetwork/java/javase/documentation/tzupdater-readme-136440.html

1 answer

3


We found that JAVA has its own Daylight Saving Time (DST) and that it is necessary to update the configuration due to default changes.

JAVA ORACLE or OPENJDK

  1. Download the latest version of TZDATA
  2. Download the Tzupdater Tool
  3. Execute the command below (specify the full path)

    export JAVA_HOME=caminho do java
    java -jar tzupdater.jar -f -l file:///home/USER/Downloads/tzdata-latest.tar.gz
    

If the error occurs, simply unzip the tzdata file, comment on the file line and resume compressing the TZDATA.

Using file:///home/USER/Downloads/tzdata-latest.tar.gz as source for tzdata bundle.
Failed: java.lang.Exception: Failed while parsing file '/tmp/tz.tmp_6/asia' on line 1655 'Rule  Japan   1948    1951    -   Sep Sat>=8  25:00   0   S'
java.lang.Exception: Failed while parsing file '/tmp/tz.tmp_6/asia' on line 1655 'Rule  Japan   1948    1951    -   Sep Sat>=8  25:00   0   S'
    at tools.tzdb.TzdbZoneRulesCompiler.parseFile(TzdbZoneRulesCompiler.java:377)
    at tools.tzdb.TzdbZoneRulesCompiler.compile(TzdbZoneRulesCompiler.java:191)
    at tools.tzdb.TzdbZoneRulesCompiler.<init>(TzdbZoneRulesCompiler.java:307)
    at com.sun.tools.tzupdater.ExternalModule.compileToJSRBinary(ExternalModule.java:153)
    at com.sun.tools.tzupdater.TimezoneUpdater.run(TimezoneUpdater.java:230)
    at com.sun.tools.tzupdater.TimezoneUpdater.main(TimezoneUpdater.java:634)
Caused by: tools.tzdb.DateTimeException: Invalid value for SecondOfDay value: 90000
    at tools.tzdb.ChronoField.checkValidValue(ChronoField.java:173)
    at tools.tzdb.LocalTime.ofSecondOfDay(LocalTime.java:210)
    at tools.tzdb.TzdbZoneRulesCompiler.parseMonthDayTime(TzdbZoneRulesCompiler.java:475)
    at tools.tzdb.TzdbZoneRulesCompiler.parseRuleLine(TzdbZoneRulesCompiler.java:399)
    at tools.tzdb.TzdbZoneRulesCompiler.parseFile(TzdbZoneRulesCompiler.java:354)
    ... 5 more
  1. Standard output

    java -jar tzupdater.jar -f -l file:///home/USER/Downloads/tzupdater-2.2.0/tzdata/tzdata.tar.gz 
    
    Using file:///home/USER/Downloads/tzupdater-2.2.0/tzdata/tzdata.tar.gz as source for tzdata bundle. 
    

JAVA IBM

  1. Effect download tool IBM Time Zone Update Utility

  2. Create directory /tmp/jtzu, copy file to folder and uncompress file

    mkdir /tmp/jtzu
    cd /tmp/jtzu
    scp jtzu-1.7.18e.zip /tmp/jtzu
    unzip jtzu-1.7.18e.zip
    
  3. Change the file runjtzuenv.sh, setando NOGUI to disable the graphical interface

    NOGUI=true
    
  4. Run the file to perform Vms Discovery

    bash runjtzu.sh
    
  5. The previous command generates the file SDKList.txt with all Java installations found.

  6. Change the file runjtzuenv.sh

    NOGUI=true
    DISCOVERONLY=false
    SILENTPATCH=false
    
  7. Run the file again

    bash runjtzu.sh
    
  • I created a repository with the above-mentioned fix already compressed: https://github.com/psybox/tzdata_temer

Browser other questions tagged

You are not signed in. Login or sign up in order to post.