Java environment variables and their functionality

Source: Internet
Author: User

1. PATH env Variable

It is used to search for the command directory When we use the console type commands. We only can use the javac and java command anywhere after the jdk\bin and jdk\jre\bin Directory has been added in to the PATH env variable.

e.g. "C:\Program files\java\jdk1.6.0_21\ bin; C:\Program files\java\jdk1.6.0_21\jre\bin", the ';' is the separator between env Variables.

2. CLASSPATH env Variable

It is used to search the known classes, which include the default classes used by JVM and the current CL Asses we created. Thus we add '.' directory including the classes in current directory, and the Jdk\lib\dt.jar an D Jdk\lib\tools.jar including the default classes JVM would use.

e.g. ".; C:\Program files\java\jdk1.6.0_21\lib\Dt.jar; C:\Program files\java\jdk1.6.0_21\lib\tools.jar".

3. Java_home env Variable

It is used to indicate the directory of JDK. Many softwares like Eclipse, NetBeans, Tomcat would use this env variable to execute JDK.

e.g, "C:\Program files\java\jdk1.6.0_21".

Concrete Steps:

As all the env variables would involve the directory of JDK, we can set the Java_home first. Then we can use the %java_home% make and other env variables setting simple.

1. Java_home=C:\Program files\java\jdk1.6.0_21

2. path=%java_home%\ bin;%java_home%\jre\bin

3. classpath=.; %java_home%\lib\Dt.jar;%java_home%\lib\Tools.jar

.

Java environment variables and their functionality

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.