How do you get javac out of cmd to correctly display cyrillic symbols in the name of the file when the results of the compilation are taken?



  • Compilation of java file with a Cyrillian on a command line. If mistakes are made, the hieroglyphs are removed. Is there something we can decide?



  • In the consolecmd.exe_

    chcp 1251
    

    It's enough to do this once at every consol launch. javac In Russian-speaking Windows, the message is coded cp1251 and the console uses cp866.

    Example:

    E:\>chcp 1251
    Текущая кодовая страница: 1251
    

    E:>javac -encoding utf8 ./Проверка.java ./Проверка2.java
    .\Проверка2.java:3: error: cannot find symbol
    System.out.pri("Работает! 2");
    ^
    symbol: method pri(String)
    location: variable out of type PrintStream
    1 error

    Key -encoding utf8 indicates the coding of the original file.

    You can do the opposite and explain. javacthat he should put the text in the right code using the key -J-Dfile.encoding=cp866:

    E:>chcp 866
    Текущая кодовая страница: 866

    E:>javac -J-Dfile.encoding=cp866 -encoding utf8 ./Проверка.java ./Проверка2.java
    .\Проверка2.java:3: error: cannot find symbol
    System.out.pri("Работает! 2");
    ^
    symbol: method pri(String)
    location: variable out of type PrintStream
    1 error

    A code page should be included in utf-8 65001 and ask for code utf8 I'll give you a compilator.

    A variable environment can be used to codify the withdrawal for all java challenges JAVA_TOOL_OPTIONS




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2