Install JDK Linux Step 1. First download jdk (jdk-1_5_0_02-linux-i586.rpm) from the Internet, recommended SUN official website www.sun.com, download and put in the/home directory, of course, other places also.
Go to the installation directory
# Cd/home
# Cp jdk-1_5_0_02-linux-i586.rpm/usr/local
# Cd/usr/local
Add executable permissions to all users
# Chmod + x jdk-1_5_0_02-linux-i586.rpm.bin
#./Jdk-1_5_0_02-linux-i586.rpm.bin
The file jdk-1_5_0_02-linux-i586.rpm is generated, and executable permissions are also added to all users
# Chmod + x jdk-1_5_0_02-linux-i586.rpm
Installer
# Rpm-ivh jdk-1_5_0_02-linux-i586.rpm
If the installation protocol is displayed, simply accept it.
Install JDK in Linux Step 2. Set environment variables.
# Vi/etc/profile
Add at the end
# Set java environment
JAVA_HOME =/usr/java/jdk-1_5_0_02
CLASSPATH =.: $ JAVA_HOME/lib. tools. jar
PATH = $ JAVA_HOME/bin: $ PATH
Export JAVA_HOME CLASSPATH PATH
Save and exit.
To enable JDK to be used by all users, you can:
Vi/etc/profile. d/java. sh
Enter the following content in the new java. sh file:
# Set java environment
JAVA_HOME =/usr/java/jdk-1_5_0_02
CLASSPATH =.: $ JAVA_HOME/lib/tools. jar
PATH = $ JAVA_HOME/bin: $ PATH
Export JAVA_HOME CLASSPATH PATH
Save and exit, and then assign the permission to java. sh: chmod 755/etc/profile. d/java. sh
Install JDK in Linux Step 3. Use the echo command on the terminal to check the environment variable settings.
# Echo $ JAVA_HOME
# Echo $ CLASSPATH
# Echo $ PATH
4. Check whether JDK is successfully installed.
# Java-version
If you see the JVM version and related information, the installation is successful!
Then the installation of JDK in Linux is over and the development door is opened. GOGOGO!