How to set the JVM charset on the command line?
14,007
Solution 1
Java strings are always UTF-16 internally (javadoc link), but you can use -Dfile.encoding=UTF-8
to facilitate reading files with a default charset.
Just ensure Java has access to that fileset when you set it or it won't start.
Solution 2
java.nio.charset.Charset.defaultCharset() Will get you the JVM's default charset.
Author by
One Two Three
Updated on June 04, 2022Comments
-
One Two Three almost 2 years
What's the command to set the JVM's character set?
(Also, what's the command to view the current JVM's character set, so I know how to reset it back to default after I'm done)
Thanks,