Install jdk in linux and linuxjdk
1. Install JDK in Linux Step 1. First download jdk (jdk-1_5_0_02-linux-i586.rpm) from the Internet, recommend SUN official website www.sun.com, download and put it 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
2. Add executable permissions to the user
# 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
3. Installer
# Rpm-ivh jdk-1_5_0_02-linux-i586.rpm
Accept the installation protocol.
4. Install JDK in Linux Step 2. Set environment variables.
# Vi/etc/profile: enter "Save and quit" in wq and enter: q! "Do not save the current operation and Exit" and press Enter)
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
5. 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
6. Check whether JDK is successfully installed.
# Java-version
If you see the JVM version and related information, the installation is successful!
Source/etc/profile