Java compilation error Unable to map to encoding windows-31j

Anyway, let's touch Java ①

I don't know if it will continue, but I tried to make it a continuation-like title.

Java that I have never experienced before. Java that I have a little admiration for. When I thought I could finally challenge this time, I was taken to another person in front of me. So, I started studying Java voluntarily because I was disappointed.

Reference site

Easy introduction to Java DAY5: Error: This character cannot be mapped to encoding MS932

Start

Anyway, I thought it would be easy to get started, so first of all, the reference site "Introduction to Java" After preparing the environment according to the procedure, an error occurred when I thought about "Hello World". The cause was a difference between the JDK and JRE versions. This could be dealt with by changing the order of the environment variables. (There were multiple JREs in different versions on my PC)

Next, if you want to compile a program that contains Japanese An error occurred again.

The cause seems to be a difference in the character code, and this was also solved by specifying the character code at compile time, referring to the reference site "DAY5: Error: This character cannot be mapped to the encoding MS932".

Error: This character (0xEF) cannot be mapped to encoding windows-31j Cause: Difference in character code Workaround: Compile with "-encoding UTF-8"

javac -encoding UTF-8 Scores.java

Impressions

Java that I couldn't get my hands on until now. I finally understood the meaning of saying "Because the Java version is different" in the distance. It's hard to experience in business, but I hope I can continue in detail.

Recommended Posts

Java compilation error Unable to map to encoding windows-31j
[Java] How to use Map
[Java] How to use Map
How to use Java Map
[Java] Convert 1-to-N List to Map
JAVA (Map)
[Java] Map # merge is hard to understand.
[Java] Corrective notes for "Invalid escape character" and "Cannot map to encoding MS932"
Unable to connect to chromedriver error when running SystemSpec
[Java] Classification memo of compilation error and run-time error
Today's java error
[Java] Map comparison
[Java] Introduction to Java
java error countermeasures
Introduction to java
How to loop Java Map (for Each / extended for statement)
I want to get along with Map [Java beginner]