Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JRE 8 and Locale.setDefault(), java 8 update 5, Windows 7

LausJul 31 2014 — edited Aug 5 2014

Hello,

I have simple question that i can't resolve.

I am working on JavaFX application in which I am using DatePicker. This part is not important.

My date picker is formating date based on my Windows 7 OS Regional and Language settings(Formats).

This part is now relevant:

In order to try to make my app Regional independant, and show date format always as US, I only once used this line of code:

Locale.setDefault(Locale.ENGLISH);

Here is problem:

Now when I remove this line of code "Locale.setDefault(Locale.ENGLISH)" my application is no longer able to get Regional format from my Windows 7 OS Regional and Language settings(Formats). Locale informations are permanently lost in JVM. Things are even worse, because my JDBC connection is not working now, and it reports:

java.sql.SQLException: Locale not recognized

  at oracle.jdbc.driver.T4CTTIoauthenticate.setSessionFields(T4CTTIoauthenticate.java:1006)...

How can I revert to old JVM behaviour, and get Locale information from my Windows 7 OS Regional and Language settings(Formats) automatically? Any help?

The application now is only working when there is Locale.setDefault(Locale.ENGLISH); line in code.

This post has been answered by Laus on Aug 5 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2014
Added on Jul 31 2014
4 comments
3,353 views