Analysis of java environment variable configuration principles and eclipse import outsourcing methods, eclipse Outsourcing

Source: Internet
Author: User

Analysis of java environment variable configuration principles and eclipse import outsourcing methods, eclipse Outsourcing

1. PATH environment variable. The function is to specify the command search PATH. When you execute a command below the command line, such as javac, when compiling a java program, it will go to the PATH specified by the PATH variable to check whether the corresponding command program can be found. We need to add the bin directory under the jdk installation directory to the existing PATH variable. The bin directory contains frequently used executable files such as javac/java/javadoc waiting, after setting the PATH variable, You can execute tools such as javac and java in any directory. The PATH value we set here is:

% SystemRoot %/system32; % SystemRoot %/System32/Wbem; % SYSTEMROOT %/System32/WindowsPowerShell/v1.0/; C: /Program Files/Common Files/Thunder Network/KanKan/Codecs; C:/Program Files/Microsoft SQL Server/90/Tools/binn/; C: /Program Files/Common Files/TTKN/Bin; C:/Program Files/Common Files/Teleca Shared; C: \ Program Files \ Java \ jdk1.8.0 _ 101 \ bin

The above only contains the red part. C: \ Program Files \ Java \ jdk1.8.0 _ 101/bin is the java PATH variable. Note that the variables must be separated.

2. CLASSPATH environment variable. The function is to specify the Class search path and use the classes that have already been compiled. The premise is that you can find them, and JVM searches for classes through CLASSPATH. We need to set dt. jar and tools. jar in the lib subdirectory under the jdk installation directory to CLASSPATH. Of course, the current directory "." must also be added to this variable. Here CLASSPATH is:

.; C: \ Program Files \ Java \ jdk1.8.0 _ 101/lib/dt. jar; C: \ Program Files \ Java \ jdk1.8.0 _ 101/lib/tools. jar; C: \ Users \ U \ algs4 \ algs4.jar;

3. JAVA_HOME environment variable. It points to the jdk installation directory. Eclipse, NetBeans, Tomcat, and other software find and use the installed jdk by searching the JAVA_HOME variable. JAVA_HOME:

C: \ Program Files \ Java \ glasis1.8.0 _ 101

........................................ ........................................ ........................................ ................

What is CLASSPATH? What is its role?

It is an environment variable of the javac compiler. Its role is related to the import and package keywords. When you write improt java. util. * When the compiler faces the import keyword, it will know that you want to introduce java. util is a class in the package. But how does the compiler know where you put the package? So you must first tell the compiler where the package is located. How can you tell it? Set CLASSPATH: if the package of java. util is in the c:/jdk/directory, you must set the path of c:/jdk/to CLASSPATH! When the compiler faces the import java. util. * In this statement, it first looks for the directory specified by CLASSPATH, checks whether the subdirectory java/util exists, and then finds the compiled file (. class file ). If not found, an error is returned! CLASSPATH is a bit like the INCLUDE path settings in the c/c ++ compiler, isn't it? How does a c/c ++ compiler operate a statement such as include? Oh, the truth is almost the same! Search INCLUDE path and View File! When you develop a package, you want to use the classes in the package. Naturally, you have to set the directory of the package to CLASSPATH!

........................................ ........................................ ........................................ ..................

The above is reproduced in http://www.cnblogs.com/xwdreamer/archive/2010/09/08/2297098.html

 

In Eclipse, how does one import external JAR packages?

1. Import the External package (External Archives.

In Package Explorer on the left of the Eclipse window by default, right-click the project name and clickProject-> Properties-> Java Build Path-> Libaries-> Add External JARs.. Then, select acm. jar in the pop-up file selection window.

This method is suitable for importing a single jar package.

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.