Friday, September 6, 2013

The story starts when the Israeli governmentdecided to change the date of the Time change between IST and IDT from 08/09/2013 to 27/10/2013.

There is no problem with that fact, unless you don't update your Java Version to the latest update like us. (Usually this happens when you work in a closed network not open the Internet).

Again, there would have been no problem if we had only one version of JVM in our organization, but unfortunately I found out that the situation is not so simple.

We had Java installations running with different Vendors (Oracle, IBM, HP, OpenJDK) and Multiple Versions (1.2 – 7.0) and different Operation Systems (Windows, Linux, Unix).
Many of the installations were inside Software products as folders, that the Outer products were running on these JVM's.

That was quite a Nightmare!

And the option of updating all the versions of the JRE/JDK's wasn't available!!

So there is a different way to update the Time zone configurations of the JRE/JDK,
But let's start with a little background:

The Time zones table that is used in the world is Olson Implementation.
I won't go into detail about the definitions. You can find more information in the following links: Wikipedia, Dalight Saving Time.

When the JVM takes the Time Zone that it should start with by default from the Operation system. (Or you can give it a JVM flag that is called "user.timezone" in the run command of the java process -> for example : "-Duser.timezone=Asia/Jerusalem").

The operation system defines when the Clock should switch between the IST and IDT time, but the Java Environment ignores it, and uses it's own Table that is based on the Same principle. All of the different vendor need to keep their JVM configuration up to date with updates.

So the problems we encountered (and the solutions of course):

1)How do you find our which vendor and java version you are running?Answer:

I wrote a little java program ("jvm-info") that prints out all the vital information of your installed JRE/JDK, here it is:

- I zipped the code as an Executable JAR file to run it more easily on the destination JVM.

- Be sure that the java execution version of the Project is 1.4!!
If not the JAR file won't run on lower JRE/JDK versions.

- Within an OS that has the JAVA_HOME system variable in the PATH of the OS,

When you will run "java –jar jvm-info.jar", it will execute on that java installation, if you want to execute it on a different installation, just enter the relevant directory ("[JAVA_INSTALL_DIR]\bin") and run it from there.

2) Where do you find the update for each of the different vendors and JRE/JDK versions?

Answer:

After finding out all the different vendors and versions of the JVM's I wanted to update, I started searching all of them, and these are the findings with link's of usage and downloads of the Updaters:

Important Notes:

- All of the updates work on JRE/JDK version: 1.4.x/5.0.x/6.0.x/7.0.x.
I couldn't find earlier JVM versions update tools.

- All of the update tools need to run in "Administrator" or "root" privileges, it won't work otherwise.

- You need to restart the running JVM, the updates are made locally on the Disk and running JVM's are not influenced.

The tool is different from HP and Oracle, the usage is explained in the README file inside the zip, you'll need to modify the relevant "runjtzuenv" file according to your OS. And then run the "runjtzu" file.Note:

- You'll need to define the JAVA_HOME for the tool to run from.

- The tool searches for all IBM Java installation on your OS and updates it.

- Change the flags in the runjtzuenv file according to your wishes.

OpenJDK (Running on Red Hat 6 Linux)

The updater tool for this kind of Java installation is not the same one as the oracle JVM, Red Hat Released an official RPM that updates the time zone table of the OpenJDK in it's Linux distributions, it could be found in the next link.

(RPM change log link)Note:Be sure to install the RPM with the "update" flag and not the "install", because it will fail otherwise.

3) How can I check that the update was successful and the time won't just change at the wrong time?!?!

Answer:

With the Oracle and HP tools you can check the version currently installed with command: "java –jar tzupdater.jar -V"

For example:

This is the output, you can see that the current JRE and the updater version are not the same.

And here you can see that after the update the output is like this:

I wrote another little Java program ("tz-tester"), and ran it just like with the first program, as an Executable JAR.