I have java code running on a server. When the user changes the timezone in the System (say in Windows Control Panel), I had to automatically detect it and send it to the users. If i try to get the timezone via calendar.getTimezone() or TimeZone.getDefault(), I get the timezone information while the java code is started. I don't find a reliable way to get the timezone from the system control panel.
Is there any method to get the System Timezone in Java?
Check this related issue: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4216582
May not be the best way but one approach can be to write a C/C++ wrapper to make a system call to the OS to get the timezone information and call it using native method from your Java code. E.g. for Windows you use GetTimeZoneInformation function (http://msdn.microsoft.com/en-us/library/windows/desktop/ms724421%28v=vs.85%29.aspx)