Java Environment Building and first program

Source: Internet
Author: User

    • Java Environment Building

1. After installing the Java version, set the environment variables. (My Computer-Properties-Advanced system Settings-Advanced tab-environment variables)

New Java_home "," PATH ", and" CLASSPATH "variables in system variables

Variable name: java_home

Variable Value: C:\Program files\java\jdk1.7.0_79

Variable name: PATH

Variable value:%java_home%\bin;%java_home%\jre\bin;

Variable name: CLASSPATH

Variable value:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

    • Test environment variable Configuration

1. Win+r, enter CMD to enter command prompt

2. Enter "Java", "Java-version" and "Javac" respectively to view the results.

    • Make the first Java program "HelloWorld"

public class HelloWorld {
public static void Main (String []args) {
System.out.println ("Hello World");
}
}

  

    • debugging Java with cmd

1. Win+r, enter CMD to enter command prompt

2. Enter "D:" (drive letter to open Java file)

3. Enter "CD D:\desktop" or "CD desktop" (Open the folder where the Java files are located)

4. Enter "Javac Helloworld.java" (Compile Java file)

5. Enter "Java HelloWorld" (View program results)

  

  

    • CMD command Lookup
      • "CD" opens a folder under the current directory or opens a folder under the current drive letter path, such as "CD desktop" and "CD D:\desktop"
      • "Cd\" returns to the root directory
      • "CD.." Return to the previous layer
      • Dir View all directories under the disk

Java Environment Building and first program

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.