Set UTF-8 encoding on Netbeans

Update Netbeans file encoding

If you use an operating system which default file encoding is not UTF-8 (e.g. Windows) it is sometimes beneficial to change the file encoding NetBeans IDE will use.

Logo by netbeans.org
NetBeans IDE Logo

NetBeans IDE will use, as all Java applications, the operating system’s file encoding by default. To force the ide to use UTF-8, the following configuration needs to be added to the netbeans_default_options parameter

-J-Dfile.encoding=UTF-8

The parameter netbeans_default_options is defined in the file

<netbeans_installation_path>/etc/netbeans.conf

Before the update the parameter definition could look like

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true"

After the change it should then look like

netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true -J-Dfile.encoding=UTF-8"

After a restart UTF-8 is used as file encoding.