To compile a Java file:
1. File background: D.h.java extends D.f.f.java
2. Absolute path: Javac-sourcepath D folder directory H.java full path
3. Relative path: CD to D (H.java directory), Javac-sourcepath D folder directory H.java
The SourcePath (source file path) is specified because D.h.java extends D.f.f.java, does not explain
4, in Chinese when the specified code: javac-encoding utf-8 H.java (here the encoding and save the file as specified in the encoding of the same)
Run the class file:
A,-CLASSPATH/-CP (exactly the same, specify temporary CP); Do not write the extension. class
B, Package is D, must write D.H, and D folder is not free. Absolute path to the H.class file: "CP"/d/h.class
1. Environment variable does not match JRE:CD to JRE\BIN>JAVA-CP D folder in the same directory D.H
2. Environment variable is JRE:JAVA-CP D folder directory D.H
(or CD-to-D folder in the same directory, such as the desktop, the desktop as a temporary CP,JAVA-CP. D.H)
(If the D folder is in the directory specified by the environment variable CP, Java D.H)
3, Java-jar jar file full path (-jar no CP one said)
Write a batch file, and when you run the. class file, specify that the current directory is temporary classpath:
JAVA-CP. H--Executes the h.class under the current directory
JAVA-CP. H--Executes the h.class in the current directory at the level of the directory
Moderator's personal website: http://liaolongjun.duapp.com/
Take care of this picture, Javac can graduate.