java notes 01

In windows, java environment configuration.

javac HelloWorld error:

How to reproduce?

The Notepad to open the .java file is saved with utf8 format. javac not recognize. Because the notes under the windows of this utf8 is bom with.

 

java HelloWorld error:

The reason for this problem is to configure configuration issues before failure when the environment variable classpath, my configuration before classpath is lib file in the folder jdk installation directory, namely: "D: \ working \ Java \ jdk-9.0.4 \ lib" . But this alone is not enough, you also need preceded by a semicolon and the English period, namely: ".; D: \ working \ Java \ jdk-9.0.4 \ lib". Then close the previous cmd, and then re-open into the current directory, and then type: java HelloWorld, ( be careful not to have a relative path java \ HelloWorld are being given. ) Press Enter to run the program, everything is normal.

 

[Notepad ++] Error: The character encoding GBK unmappable

A plus tool javac -encoding parameters specified at compile time encoding: javac -encoding UTF-8 Test.java

Second, Notepad ++ menu bar, select Settings -> Preferences -> New Document, and then select Encoding UTF-8 from the field changed to ANSI.

 

Guess you like

Origin www.cnblogs.com/liuliu-hai/p/12147407.html