Java Configuration JDK Development environment and environment variables _java

Source: Internet
Author: User

Body

1, the installation of JDK development environment

Download site:http://www.oracle.com/

To begin installing the JDK:

Modify the installation directory as follows:

When you are sure, click Next.

Note: When prompted to install the JRE, you can choose not to install it.

2. Configure Environment variables:

For Java program Development, the main use of JDK two commands: Javac.exe, Java.exe. Path: C:\Java\jdk 1.7.0 _09\bin. However, these commands do not belong to Windows own commands, so you need a path configuration if you want to use them.

Click Computer-Properties-advanced system settings, and click Environment Variables. Click New under the System Variables column to create a new system environment variable.

(1) New-> variable name "java_home", Variable Value "C:\Java\jdk1.8.0_05" (that is, JDK installation path)
(2) Edit the-> variable name "Path" and add ";%java_home%\bin;%java_home%\jre\bin" at the end of the value of the original variable.
(3) New-> variable name "CLASSPATH", Variable Value ".; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar "

For example: Java_home environment variables are operated as follows:

3, verify that the environment is actually configured:

Enter the java,javac,java-version command separately in the console, and the JDK's compiler information, as shown below, includes information such as modifying the syntax and parameter options for the command.

Java command:

Javac command:

Java-version command:

4. Verify the first Java program under the console:

Copy Code code as follows:
public class Test {public static void main (string[] args) {Systerm.out.println ("Hello Java");}

Written in Notepad, click "Save", and deposited in the C-packing directory, input javac Test.java and Java Test command, you can run the program (print out the result "Hello Java"). Note: These two commands are in the D:\java\jdk1.8.0_20\bin directory.

Program Resolution:

First write Java source Code program, extension. java;

In command-line mode, enter the command: Javac the source file name. Java, compile the source code, generate the class bytecode file;

After compiling, if no error message, input command: Java HelloWorld, the class bytecode file interpretation run, do not need to add. class extension. See figure below:

Note: If you enter Javac Test.java command in cmd, the display ' Javac ' is not an internal or external command, because the JDK development environment or environment variable configuration is not properly installed in advance.

Related Source:

SOURCE Location: D:\java\jdk1.8.0_20\src.zip

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

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.