I wrote a version of poker that uses special characters to represent the particular suits of the cards (for example, ♠) when printed to the console. Everything is fine in Eclipse, it prompts me to save as UTF-8 and it works just fine. However, when I converted my runnable jar to an exe via Launch4j, it will show a hand as [K ?, A ?] for instance.
I attempted to add the JVM option -Dfile.encoding="UTF-8"
but have not found any luck. Any ideas?
Asked
Active
Viewed 343 times
0

Matthew Vandenberg
- 87
- 9
-
Are you using properties resource file? – Claudio Weiler Dec 14 '20 at 21:20
-
What is this for? – Matthew Vandenberg Dec 14 '20 at 21:26
-
What happens when you ran the compiled jar (separate from eclipse) before you package it with Launch4j? I suspect it is not a Launch4j issue, but a resource/font issue. – sorifiend Dec 14 '20 at 21:30
-
Same deal, the program will show ? instead of the characters when I run the jar file from command prompt. – Matthew Vandenberg Dec 14 '20 at 21:33
-
1As suspected it is an issue with the support font type of the console. Some more info here: https://stackoverflow.com/questions/34360830/printing-unicode-to-console – sorifiend Dec 14 '20 at 21:35
1 Answers
0
After doing some research, I found an answer. In java you need to create a seperate PrintStream which is needed whenever you want to print any Unicode Character, like so. Then you need to type cmd /c chcp 65001
to change the recognized CharSet, then you will be able to run the program just fine.

Matthew Vandenberg
- 87
- 9