Getting the correct time in JVM 1.5 and 1.6
Maybe some of you out there are also using Sun’s JVM on your linux box but did not yet realise that the timezone settings in Java would not match the ones you use in you Gnome settings or system settings. The reason for that is that the JVM looks at a file /etc/localtime to find these timezone settings and apparently wants it to be a Symlink and not a file per se, so let’s fix it~
- backup your /etc/localtime
sudo cp /etc/localtime /etc/localtime.bak - now let’s link to the correct file after making a backup of it. In my case “Asia/Hong_Kong”, look for other regions in /usr/share/zoneinfo/
sudo cp /usr/share/zoneinfo/Asia/Hong_Kong /usr/share/zoneinfo/Asia/Hong_Kong.bak
sudo ln -s -f /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime