Install jdk7 on Linux system

Take Centos7 as an example
1. First switch to the root user in case the permissions are not enough
$ sudo su
2. Go to the /usr folder and create a new folder java
mkdir java
3. Upload jdk to Linux
To upload or download, you need to use the rz and sz commands. If these two command tools are not available on linux, you need to install them first. It can be installed using yum. Run the command yum install lrzsz.
4. After the installation is complete, you can use the rz command to upload local files to the linux platform. Run the rz command, and a dialog box for selecting a file will pop up.
5. Select the path of the local file, select the file, then click the Add button, and then click OK to upload

6. Upload complete

7. Unzip
tar -zxvf jdk-7u80-linux-x64.tar.gz
After decompression, there will be one more folder: jdk1.7.0_80
8. Configure jdk environment variables
Open the profile file: vi /etc/profile
Then press i to enter edit mode and add the following environment variable configuration at the end of the file:
JAVA_HOME=/usr/java/jdk1.7.0_80
PATH=$JAVA_HOME/bin:$PATH  
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_HOME PATH CLASSPATH
Then ESC to exit edit mode, then enter: wq save and exit
9. Make environment variables take effect immediately
Enter the command: source /etc/profile
10. Check if the installation is successful
Enter java -version

Successful installation!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472244&siteId=291194637