I wrap a Java Swing client with the Launch4j maven plugin (version 1.7.8), and I'm trying to get text fields to use Swedish locale (number formatting, currency). I've noticed that the locale settings seems to be forced to en-US when we use Launch4j. I've confirmed this by running the original .jar with cmd, and a text field displays the number 12345 as "12 345" (Swedish locale). When I run the executable generated by Launch4j, the text field displays "12,345" (English locale).
I've tried setting <opt>-Duser.language=sv</opt> and <opt>-Duser.country=SE</opt> in <jre> opts, and also specifying locale programatically in a static context in Java, but no luck. Any ideas?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It should be no different when launching the original jar and using launch4j, the only difference I can see is that java is launched by another process but that should not affect the locale. I tried this with Polish local and it's not overwritten. The strange thing is that you say it does not work after setting the locale programatically, I completely cannot see how launch4j could influence that.
Try to output the user.language, user.country and user.variant properties to see their values upon running the app in order to determine if in fact the locale is wrong or if the problem is only in swing.
Is the jar exactly the same one as wrapped? Try running java from the command line but instead of the jar use the exe file (java -jar app.exe) and see what happens. This will work as the wrapped app is still a valid jar.
Grzegorz
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wrap a Java Swing client with the Launch4j maven plugin (version 1.7.8), and I'm trying to get text fields to use Swedish locale (number formatting, currency). I've noticed that the locale settings seems to be forced to en-US when we use Launch4j. I've confirmed this by running the original .jar with cmd, and a text field displays the number 12345 as "12 345" (Swedish locale). When I run the executable generated by Launch4j, the text field displays "12,345" (English locale).
I've tried setting <opt>-Duser.language=sv</opt> and <opt>-Duser.country=SE</opt> in <jre> opts, and also specifying locale programatically in a static context in Java, but no luck. Any ideas?
It should be no different when launching the original jar and using launch4j, the only difference I can see is that java is launched by another process but that should not affect the locale. I tried this with Polish local and it's not overwritten. The strange thing is that you say it does not work after setting the locale programatically, I completely cannot see how launch4j could influence that.
Try to output the user.language, user.country and user.variant properties to see their values upon running the app in order to determine if in fact the locale is wrong or if the problem is only in swing.
Is the jar exactly the same one as wrapped? Try running java from the command line but instead of the jar use the exe file (java -jar app.exe) and see what happens. This will work as the wrapped app is still a valid jar.
Grzegorz