Compilation and operation of Java programs

Source: Internet
Author: User

Compilation of Java programs

First write a Java program need to run (the file is saved with a. Java end of the file is called the source file, the source code is written in the source code called)

This. Java end-of-file cannot be run directly, and it needs to be compiled with the Javac.exe command to end the. class file

The Java compiler loads the Java source files that we write, then checks the syntax of the source code, and if a syntax error occurs, we call it a compilation error. If a compilation error is encountered, the. class file is not generated,

When we encounter compilation errors, we need to analyze and resolve them according to the information of the error message.

In cmd to compile open cmd, find the folder to save the file, (there is an easy way to find the folder, directly from the above input box (path) input cmd, in the main console can directly find into this folder), and then enter

Javac (space) Java file name (note: file suffix name.) Java to add, the space is to knock a space, do not enter the parentheses and the Chinese characters Kazakhstan) if not error then compile complete, and then open the storage folder to housekeeping there is a suffix. class file with the same name, at which time the compilation is complete.

Operation of Java Programs

Open cmd input Java (space) folder name (at this time no suffix name, enter the file name directly), and then enter to run successfully

Compilation and operation of Java programs

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.