Take care of this picture, Javac can graduate.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.