預設 GBK 僅限中文環境,國際協作、開源專案、跨平台部署皆需 UTF-8 避免亂碼。
Window → Preferences → General → Content Types,右側選 Java Class File,Default encoding 改 UTF-8 → Update。Text → Java Source File 改 UTF-8 → Update。General → Workspace,Text file encoding 選 Other: UTF-8 → Apply and Close。




新建 Java 檔案,輸入中文註解,存檔後用記事本開啟確認編碼為 UTF-8(無亂碼)。