Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1780
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an example:

Regards
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! That was very useful.
 
Marshal
Posts: 62170
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try a 4 years thread, and yes - Thank you!
 
Campbell Ritchie
Marshal
Posts: 62170
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

We have downgraded that FAQ because it is becoming obvious how useful old threads can be
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!