Update - for newer versions of Java (17 onwards), things are a bit different. See The NetBeans Output Window - Revisited for details.
StandardCharsets.UTF_8 rather than the literal string “UTF-8” avoids the need to handle an
In some cases, you may also need this Java command line option:
If it’s the console used by NetBeans, add the option to the default options in:
Something like this (with the additional -J in this case):
An alternative approach in NetBeans is to go to Project Properties > Run > VM Options, and add this:
After that, the
") command should work without needing the
To check what default encoding the JVM is using, use:
One final item: If you are using Windows and you want to change the command console to use UTF-8 for output, then run this command:
And make sure you are using a font which can actually display the characters you need to show.