0
0

More than 3 years have passed since last update.

java エンコーディングMS932にマップできません エラー解消しよう (記録)

Posted at

Java日本語のコンパイルエラー解消

以下のコードをコンパイルしようとしてエラーが発生

MyApp.java
import java.io.*;

class MyApp{
      public static void main(String[] args) throws IOException
    {
      System.out.println("文字を入力してください");

      BufferedReader br =
        new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        System.out.println(str + "が入力されました。");

    }
}

↓コンパイル実行

javac MyApp.java

↓エラー発生

MyApp.java:11: エラー: この文字は、エンコーディングMS932にマップできません
        System.out.println(str + "縺悟?・蜉帙&繧後∪縺励◆");

対処法(コンパイル時のコマンドを変更する)

× javac MyApp.java
↓
〇 javac -encoding utf-8 MyApp.java
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0