|Changing locale in JVM? [message #1797073]
||Wed, 24 October 2018 19:49
| Reinhardt Christiansen
Registered: March 2010
I am trying to test some Java classes I have written in Eclipse via JUnit 5. Some of my tests involve changing my locale from the default on my machine, en-CA, to another one. (I want to use de-DE because I have some German language ability.) |
I've added the following to the VM arguments of the run configuration for the JUnit test case:
Just for the heck of it, I display the value of the current month name directly within the method I am testing. When I run the test though, I get "October", the English spelling, instead of "Oktober", the German spelling.
I tried adding the same argument to the VM arguments of the run configuration for the class itself but "October" still gets displayed. Clearly, my arguments are being ignored. I found several items in StackExchange that say this approach should work but they all referred to older versions of Java and Eclipse.
Has the approach changed for my current setup, Java 10.0.2 and Eclipse 2018-19 on Windows 10? If so, how do I do it now?
I noticed that when I click the Variables buttons in the run configurations that a bunch of different variable names appear but NONE of them look like -Duser.language or whatever - and none of them refer to locales.
Powered by FUDForum
. Page generated in 0.13072 seconds