Set the path, CLASSPATH, JAVA_HOME, and classpathjava_home for JAVA environment variables.

Source: Internet
Author: User

Set the path, CLASSPATH, JAVA_HOME, and classpathjava_home for JAVA environment variables.

I hope you can give me some suggestions on some mistakes made by beginners in JAVA.

If it can help the same confused students, it is a very promising thing.

When I first learned JAVA, I will certainly encounter the setting of these three environment variables. I often don't know why,

I have followed the instructions but I don't know why. Here I will give some summary.

 

First, what are environment variables?

Environment variables are some parameters used in the operating system to specify the operating system environment..

Is the variable we can set in the operating system. What are the functions of these variables? They are related to specific variable names.

Next, we will introduce the three environment variables we will set.

JAVA_HOME: This is an environment variable that We append.

Set it to the JDK installation path (for example, C: \ Program Files \ Java \ jdk1.7.0 _ 79). This path contains lib, bin, jre, and other folders.

The purpose is to write % JAVA_HOME % when we need the java path, instead of entering a long string of addresses.

Path: the default Path for running a program that is not specified in the operating system.

Append an existing Path"; % JAVA_HOME % \ bin". % JAVA_HOME % refers to the previously specified JAVA_HOME variable.

When we executeJavac HelloWorld. javaYou do not need to specify the location of the command javac,

Because the operating system will automatically go to"C: \ Program Files \ Java \ jdk1.7.0 _ 79 \ bin"SearchJavac.exeAnd then run.

CLASSPATH: the path for loading classes in the Java Runtime Environment. Only classes in classpath can be identified and loaded, and set .; % JAVA_HOME % \ lib (note the dot (.), point number indicates the current path ).

To be continued.

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.