Home >Operation and Maintenance >Linux Operation and Maintenance >How to install jdk in linux
1. Download jdk
2. Log in to Linux and switch to root user
su root
Get root user permissions, The current working directory remains unchanged (requires root password)
or
sudo -i
Does not require root password and directly switches to root (requires current user password)
Recommended related video tutorials: linux video tutorial
3. Create the java installation directory in the usr directory
cd /usrrrree
4. Change jdk-8u60-linux -x64.tar.gz
Copy to the java directory
mkdir java
5. Unzip jdk to the current directory
cp /mnt/hgfs/linux/jdk-8u60-linux-x64.tar.gz /usr/java/
Get the folder jdk1.8.0_60
6. After the installation is complete, create a link for him to save the directory length
tar -zxvf jdk-8u60-linux-x64.tar.gz
7. Edit the configuration file and configure the environment variables
ln -s /usr/java/jdk1.8.0_60/ /usr/jdk
Add the following content: JAVA_HOME according to the actual directory
vim /etc/profile
8. Restart or execute the command: source /etc/profile
JAVA_HOME=/usr/java/jdk1.8.0_60 CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
9. Check the installation status
sudo shutdown -r now
java -version
Recommended related articles and tutorials: linuxtutorial
The above is the detailed content of How to install jdk in linux. For more information, please follow other related articles on the PHP Chinese website!