Command-line window compilation execution Java

Source: Internet
Author: User

1: Configure Java Environment variables first

New system environment variable

Name: Java_home

Content: D:\Program files\java\jdk1.7.0_13 is the folder location where your JDK is located

Modify Path Path

Add%java_home%/bin;%java_home%/jre after the path;

Verify that the environment variable is configured successfully:

Run cmd--java+ carriage return

Javac + ENTER

Java-version viewing version information for Java

After the environment variable succeeds, it will output Java main execution command information in the console.

2: For example:

Create a new folder under G-Disk

Create a new text Aa.java in a

1 class aa{2      Public Static void Main (string[] args) {3     System.out.println ("AAA"); 4     }5 };

3: In the Run window enter cmd+ carriage return

The first entry is the C drive,

Enter in the window: g:+ carriage return to G drive letter

Input: CD A + return to find a folder;

Input: Dir + ENTER to see the directory under the A folder, you can find the Aa.java file you wrote;

Input: Javac Aa.java compile Java file as Java executable class file

Input: Java AA execute Aa.class file

Success in the console to see the output of the information AAA;

Failed....

Command-line window compilation execution Java

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.