Java environment variable configuration, java environment variable

Source: Internet
Author: User

Java environment variable configuration, java environment variable
1. Java installation

1. Download the appropriate version and install jdk and jre in the same folder in the same path. For example, both are installed in E: \ Java;

Note:JDK: Java Development Kit;JRE: Java Runtime Environment

To run a java program, you only need to install JRE.If you need to write a java program, you need to install JDK.

2. environment variable configuration 1. Three Ways to edit environment variables

1) Computer → properties → advanced system settings → advanced → environment variables;

2) Search for env in the upper-right corner of the control panel, and then click Edit Account environment variable

 

3) Click Start in the lower-right corner of the desktop.→ User Account→ Change my environment variables

 

2. environment variable configuration (JAVA_HOME, Path, CLASSPATH)

1)JAVA_HOME:The variable value is the personal jdk installation directory (for example:E: \ java \ jdk1.8.0 _ 31)

2)Path: Find the path in the system variable. If no path is created, enter % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin at the end of the variable value;

Note: If the original path has a value, a semicolon is required at the end of the value, and then a value is added;

3)CLASSPATH:.; % JAVA_HOME % \ lib \ tools. jar

Note: note the beginning

3. Setting Java environment variables will take effect for all users on this machine after setting user variables and system variables;
The user variable setting is only valid for the current user; Generally, system variables are set without special requirements.

 

3. Check whether the installation is successful:

1. Enter java-version in the cmd window to view the java version information;
 
2. Compile a simple class test: 
For example, a simple test class of Bird. java is put under E: \ aa:

public class Bird{    public static void main (String[] args){        System.out.print(1111);    }}

1) cd \ returns to the root directory;

2) E: Enter the E-disk directory;
3) enter the cd aa folder;
4) javac Bird. java compiles java files;
5) Java Bird runs the java class file.

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.