Introduction to JDK installation and configuration method under Linux system

  
1. Install JDK
Download JDK directly from sun website: http://java.sun.com/j2se/1.4.2/download.html provides two Download:
1, RPM in self-extracting file (j2sdk-1_4_2_04-linux-i586.bin, 32.77 MB) This is a self-extracting file, installed on linux as follows:
# chmod u+x ./J2sdk-1_4_2_04-linux-i586.bin
# ./j2sdk-1_4_2_04-linux-i586.bin
After entering yes as prompted, jdk is extracted to the ./j2sdk1.4.2_04 directory. In line with the JDK installation path in the following 2, we do the following, create an installation path under /usr/java, and test the file to the path:
# mkdir /usr/java
# cp -fr ./j2sdk1.4.2_04 /usr/java
2, RPM in self-extracting file (j2sdk-1_4_2_04-linux-i586-rpm.bin, 32.77 MB) This is also a self-extracting file, but the extracted file is J2sdk-1_4_2_04-linux-i586-rpm package, execute the rpm command to install on linux. The installation is as follows:
#chmod u+x ./j2sdk-1_4_2_04-linux-i586-rpm.bin
# ./j2sdk-1_4_2_04-linux-i586-rpm.bin
# rpm -ivh j2sdk- 1_4_2_04-linux-i586-rpm
The installation software will automatically install the JDK to the /usr/java/j2sdk1.4.2_04 directory.
Second, configure environment variables
1. Modify user environment variables
Assume that the user using java is kunp, edit the user's .bashrc file for environment variable settings.
# vi /home/kunp/.bashrc
Add in the .bashrc file:
export JAVA_HOME=/usr/java/j2sdk1.4.2_04
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib :$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
2.Modify all user environment variables
# vi /etc /profile
Add to this file:
export JAVA_HOME=/usr/java/j2sdk1.4.2_04
export CLASSPATH=$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOMR/bin
Be sure to add $CLASSPATH to the CLASSPATH path: before I did not join this stuff, when interpreting the execution of the class file It is an error.

Copyright © Windows knowledge All Rights Reserved