For older versions of NetBeans and Java, the steps described in Java Console Output with UTF-8 used to work.

Basically you could use -Dfile.encoding=UTF-8 and add it to the NetBeans config file and also as a project Java VM parameter.

Now for Java 17 and Java 18, you have to use this instead: sun.stdout.encoding=UTF-8. So, specifically, that means:

  • netbeans.conf (see below): -J-Dsun.stdout.encoding=UTF-8
  • Project properties > Run > VM Options: -Dsun.stdout.encoding=UTF-8

The netbeans.conf file can be found in a subdirectory where NetBeans was installed. On Windows, this is typically:

C:\Program Files\NetBeans-16\netbeans\etc\netbeans.conf

For Java 19, use this:


(In other words, drop the sun. part.)

Additional notes are here, including links to NetBeans tickets where the issue is discussed in more detail.


See System.getProperties():

stdout.encoding: Character encoding name for System.out. The Java runtime can be started with the system property set to UTF-8, starting it with the property set to another value leads to undefined behavior.

These changes are driven by JEP 400: UTF-8 by Default.

See also the Java 19 Internationalization Guide.