aspose file tools*
The moose likes Beginning Java and the fly likes is it possible to change jvm locale by using command line parameters ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "is it possible to change jvm locale by using command line parameters ?" Watch "is it possible to change jvm locale by using command line parameters ?" New topic
Author

is it possible to change jvm locale by using command line parameters ?

raminaa niilian
Ranch Hand

Joined: Jul 14, 2005
Posts: 551
Hi
Thank you for reading my post.
How i can change the locale that a swing application is going to run by using runtime parameters ?

for example , my application is a jar file which has localization (using some .properties files)
Now i want to change the locale by passing some parameters to jvm
i used a batch file to run my application , something like :
java -jar ramina.jar

Now it just look at system locale , and execute the application based on system default locale , how i can change the locale of java when i call it.

Thanks
Jeff Albertson
Ranch Hand

Joined: Sep 16, 2005
Posts: 1780
Changing the default Locale is easy:

Locale.setDefault(myLocale);

I don't know of a system property set aside for this, like -Djava.util.Locale=en_CA, but you could define one if you wanted to:


There is no emoticon for what I am feeling!
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
This is an example:

Regards
Srini Naga
Greenhorn

Joined: Dec 15, 2003
Posts: 1
Thanks! That was very useful.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
You're welcome

Nice to know you found something in a 3 year old thread. Have a quick look at this FAQ, however.

Welcome to JavaRanch, anyway
Maxim Veksler
Greenhorn

Joined: Feb 04, 2010
Posts: 1
Try a 4 years thread, and yes - Thank you!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39393
    
  28
Welcome to the Ranch

We have downgraded that FAQ because it is becoming obvious how useful old threads can be
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: is it possible to change jvm locale by using command line parameters ?