When a Java file created with the Atom editor is garbled when executed at the command prompt

When I executed a Java file created with the Atom editor at the command prompt, the characters were garbled!

Development environment: windows8.1, command prompt
Situation explanation
    1. Write Java code "○○ .java" using Atom
  1. Type "javac 〇〇.java" at the command prompt and compile
    1. Type "java 〇〇" at the command prompt to execute the program

⇒Japanese characters have been garbled! !!

⇒ Even if I did the same thing with Windows Powershell, Japanese characters were garbled! !!

What do you do now? ??
While looking at the following article, I messed with the character code setting of Atom and solved the garbled characters!

↓ ↓ ↓ ↓ ↓ http://www.comp.tmu.ac.jp/tmuner/faq/mac/java.html

☆ Flow of garbled characters elimination ☆

According to the above article, the character code of the command prompt in Windowws is "SJIS", so check the character code of the Atom editor of the file you are editing.

1. It turns out that the character code of the code being edited is UTF-8

スクリーンショット (195).png

2. Change the character code of the code you are editing to SJIS (Shift JIS)

スクリーンショット (194).png

3. Eliminate garbled characters! !!

スクリーンショット (197).png

Recommended Posts

When a Java file created with the Atom editor is garbled when executed at the command prompt
About the behavior when doing a file map with java
Compile Java at the command prompt
Create a jar file with the command
[Java] Create a jar file with both compressed and uncompressed with the jar command
File path is not recognized when executing an external command from a Java application
Error handling when the maximum file size is exceeded when uploading a file with Spring Boot
Java passes at the command prompt, but javac does not
Memo: [Java] If a file is in the monitored directory, process it.
[Java small story] Monitor when a value is added to the List
What is the best file reading (Java)
A troublesome story when deleting the gems file created in the gem development directory.
The problem that the JDK set in JAVA_HOME does not appear even if java -version is performed at the command prompt
When I call the file with Class # getResource from the jar file, it becomes Not Found and it is a crappy memorandum
Read a string in a PDF file with Java
A note when the heroku command becomes unavailable
ClassLoader cannot scan the desired class only when a specific maven task is executed
How to save a file with the specified extension under the directory specified in Java to the list
Connecting Java application and PostgreSQL with JDBC without using eclipse (execute at command prompt)
Form and process file and String data at the same time with Spring Boot + Java
A warning is displayed when trying to use a huge integer with the special variables $ 1, $ 2, $ 3 ...