Why does Java read its default settings from the system
Posted
by Bozho
on Stack Overflow
See other posts from Stack Overflow
or by Bozho
Published on 2010-04-18T06:44:13Z
Indexed on
2010/04/18
6:53 UTC
Read the original article
Hit count: 445
java
Java is reading the locale, timezone and encoding information (and perhaps more) from the system it is installed on.
This often brings bad surprises (brought me one just yesterday). Say your development and production servers are set to have TimeZone GMT+2. Then you deploy on a production server set to GMT. a 2-hour shift may not be easy to observe immediately. And although you can pass a TimeZone
to your calendars, APIs might be instantiating calendars (or dates) using the default timezone.
Now, I know one should be careful with these settings, but are easy to miss, hence make programs more error-prone.
So, why doesn't Java have its own defaults - UTF-8, GMT, en_US (yes, I'm on non-en_US locale, but having it as default is fine). Applications could read the system settings via some API, if needed.
Thus programs would be more predictable.
So, what is the reason behind this decision?
© Stack Overflow or respective owner