I. Unpacking and installing the JDK
Enter the directory where the Jdk-6u14-linux-i586.bin file is located under the shell terminal and then generate a jdk1.6.0_14 directory in the current 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 in the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, and after setting the path variable, you can execute the Javac/java tool 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. 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. Modifying/etc/profile files is not recommended
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.
2. Modify the. bash_profile file This is the most reliable method, but also generally in the company you can use the method.
This method is more secure, it can control the use of these environment variable permissions to the user level, if you need to give a user permissions to use these environment variables, you only need to modify their personal user home directory of the. bash_profile file on it.
• Open the. bash_profile file in the user directory with a text editor
• At the end of the. bash_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
3. Set variables directly under the shell
Do not support the use of this method, because the shell, your settings are invalid, so this method is only temporary use, and later to use the time to reset, more trouble.
Simply execute the following command at the shell Terminal:
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
Four. Test the JDK
All the people of the Earth, java-version
Five. Uninstalling the JDK
• Locate the _uninst subdirectory of the JDK installation directory
• Execute commands at the shell terminal./uninstall.sh You can uninstall the JDK.
Linux configuration Java Environment variables turn a few, this is the most detailed and reliable