I've been trying to set the default java encoding character set from "windows-1252" to "UTF8" and its not working.
I've tried using java -Dfile.encoding=UTF8
and I get
Error: Could not find or load main class .encoding=UTF8
Caused by: java.lang.ClassNotFoundException: /encoding=UTF8
in the VS code terminal and that doesn't work. I've also tried set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
and that doesn't work either I literally get nothing and the default encoding isn't changed. The curious thing is I can do this on the windows command prompt and when entering java -version
I am told the encoding is set to UTF8. However using Charset.defaultCharset()
at the beginning of the program is telling me my encoding is set to "windows-1252".