修改 NetBeans 默认编码使用 UTF-8

英语学的不好,就不详细翻译了,呵呵!简单操作是这样的

1. Linux 下操作:
在 修改默认语言为 ja_JP.UTF-8,操作如下:
  export LANG=ja_JP.UTF-8
  netbeans

2. Windows下的修改方法:
第一步:
  打开 工具-->  选项  --> 高级选项 
然后 选编辑-->Java源代码,把缺省编码修改为 UTF-8
第二步:
  修改编译选项,支持UTF-8格式
  打开 项目属性-->编译 
然后 修改"其他编译选项"值为:"-encoding utf-8"

---------------------------------------------------------------
英文原文
If you use the UNIX/Linux platform, you can start the IDE with the UTF-8 locale. Most modern UNIX/Linux platforms support UTF-8 locales. For example, if you use Japanese, 

% export LANG=ja_JP.UTF-8
% netbeans
How to set the encoding on Windows?
There is no way in Windows to change the locale at IDE startup. This means for example, that the IDE always uses Shift_JIS on Japanese Windows. When you want to use UTF-8 encoding in Java sources file, you need to change the encoding of the source editor, and add a compiler option. Please follow the steps below. 

Open Option dialog by Tools > Option 
Switch to Advanced Options 
Click the Java Source node of the Editor Editing category 
Find the "Default Encoding" field and enter "UTF-8" into the field 
This is the setting just for the Editor. Now you need to set compiler options: 

Open the project's Property dialog 
Find the "Aditional Compiler Option" field in the "Build" category 
Enter "-encoding utf-8" into the field 
How to change the encoding for other text files, e.g. .txt, .js files?
Currently, there is no recommended solution. Some people use the "-J-Dfile.encoding=UTF-8" switch as IDE startup option, but it's not a perfect solution. 



 
  

你可能感兴趣的:(linux,windows,unix,ide,Netbeans)