weilueluo
weilueluo

Reputation: 682

Java - Error message showing question marks instead of characters

$ javac Increment.java

Output:

Increment.java:6: ??: ?????
    System.out.println(++a++);
                          ^
  ??: ??
  ??:    ?
1 ???

here is the code

class Increment{
  public static void main(String[] args) {
    int a = 5;


    System.out.println(++a++);
  }
}

Does any one know what may be happening and how to fix it? Increment is just a class for testing so that a error will appear. I am running it in git-bash terminal, but I have tried it in cygwin terminal and windows's terminal as well. character-set is UTF-8.

Upvotes: 0

Views: 1459

Answers (1)

Vladimir L.
Vladimir L.

Reputation: 1126

Most probably you have a national locale set up (e.g. Russian, Chinese or anything else) that makes the Java compiler to return nationalized error messages, but your terminal (cygwin) does not support the UTF-8 output or your system does not support UTF-8 locale.

As the quickest work-around you could switch java compiler to provide error messages in English:

$ javac -J-Duser.language=en Increment.java

Upvotes: 1

Related Questions