I'm having some problems with my regional settings, namely with the getCurrencyInstance(). I tried compiling an example class, but got errors. Changing the "$" from the example into local currency format, however, didn't help either.
I don't want to tamper with my regional settings just to compile one class, any ideas how to avoid this and similar problems now and in future code?
Firstly a quick Admin matter, it's Javaranch policy to specify your full first an last name as you screen name.
Right onto your question, Can you show us the class that you tried to compile and what the error was? Basically we need more information to help you (see my sig on a guide for how to ask questions on Java ranch)
Originally posted by Rene Larsen: I don't get any exception when I run your code.
The output is:
You have the Windows Regional Options set to US, right? That was my point, you won't get this exception in the US, but you will outside of the US. I need this compiled, preferably without adjusting my Settings, so help would be appreciated.
Thanks! [ September 05, 2008: Message edited by: Ivan Vrtacnik ]
When I try the original code but use Locale.US when getting the currency instance, it works like a charm.
I guess that makes sense. $ is unknown in both Croatian and Dutch locales as far as currencies are concerned. Likewise, it would ignore the . and return 4567.0. That's because both in Croatia and in The Netherlands we use , as the decimal symbol, not .