Detailed Linux configuration Java environment variables

Source: Internet
Author: User

Detailed Linux configuration Java environment variables

I. Unpacking and installing the JDK
Enter the directory where the Jdk-6u14-linux-i586.bin file is located under the shell terminal,
Executes the command./jdk-6u14-linux-i586.bin at this point there will be a protocol, even after hitting enter, when asked whether to agree, enter Yes, return. A jdk1.6.0_14 directory is then generated under the current directory, and you can copy it to any directory.

Two. Environment variables that need to be configured
1. Path environment variable. The function is to specify the command search path, and when executing the command under the shell, it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory under the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, set Path variable (Tengyun technology ty300.com), you can execute tools such as Javac/java in any directory.
2. CLASSPATH environment variables. The role is to specify the class search path, to use the already written classes, the premise is to be able to find them, the JVM is through the classpth to find the class. We need to set the Dt.jar and Tools.jar in the Lib subdirectory of the JDK installation directory to classpath, of course, the current directory "." must also be added to the variable.
3. Java_home environment variables (Getting Started tutorial qkxue.net). It points to the JDK's installation directory, and software such as Eclipse/netbeans/tomcat finds and uses the installed JDK by searching for java_home variables.

Three. Three methods of configuring environment variables 1. Modify the/etc/profile file
This approach is recommended if your computer is used only as a development, because all user shells have the right to use these environment variables, which can pose a security issue for the system.
• Open/etc/profile with a text editor
• At the end of the profile file, add:
Export java_home=/usr/share/jdk1.6.0_14
Export path= $JAVA _home/bin: $PATH
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar

• Re-login
• annotations
A. You want to change/usr/share/jdk1.6.0_14 to your JDK installation directory
B. Use the colon ":" to separate the paths under Linux
C. $PATH/$CLASSPATH/$JAVA _home is the value used to refer to the original environment variable
When setting environment variables, be careful not to overwrite the original value, which is a
A common error.
D. Current directory in Classpath "." It is a common mistake to throw away the current directory.
E. Export is exporting these three variables as global variables.
F. The case must be strictly differentiated.

Manuscripts: Diligent Learning qkxue.net

Read the drawing evening details Linux configuration Java environment variables

Detailed Linux configuration Java environment variables

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.