Write one of the simplest Java programs with cmd

Source: Internet
Author: User

One, prepare:

1. Ensure that the computer is equipped with Eclipse software and ensure that environment variables are configured

(1) Environment variable configuration method:


Special note: JDK and Eclipse saved paths cannot have Chinese characters

1. Open My Computer--Properties--advanced--environment variables

2. New system Variable Java_home

Variable name: java_home
Variable value: The directory of the JDK, such as D:/java

3. Select the environment variable named "Path" in "System variables"
Double-click the variable to add the absolute path of the bin directory in the JDK installation path to the value of the path variable, separating it with the semicolon of the half-width and the existing path.

Variable name: Path
Added variable value:%java_home%\bin;%java_home%\jre\bin;

This is the Java environment configuration, the configuration is completed directly after the eclipse, it will automatically complete the configuration of the Java environment

Two. Create a text file, change the suffix (and rename the text type file to a Java type file) and write a full Java code

1. How to modify the file suffix:

Organization--Folder and search options--View--Hide file extension √ Remove

2. Java code in the file

Class Hello
{
public static void Main (string[] args)
{
System.out.println ("Hello World");
}
}

Three. Compiling the file Java code using CMD

1. First compile the Java file into a class file before you can use the

(1) Locate the hard drive where the current file is stored enter Javac Hello (filename) in cmd. Java then enter to compile into class file

(2) Enter Java Hello (class file name) in CMD to return

Note: The Java file name is not the same as the generated class file name, preferably in a consistent format.

Note: Jav

Write one of the simplest Java programs with cmd

Related Article

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.