How to install jdk in linux

王林
Release: 2019-12-03 14:44:48
Original
7279 people have browsed it

How to install jdk in linux

1. Download jdk

2. Log in to Linux and switch to root user

su rootGet root user permissions, The current working directory remains unchanged (requires root password)

or

sudo -iDoes 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 /usr
Copy after login
rrree

4. Change jdk-8u60-linux -x64.tar.gzCopy to the java directory

mkdir java
Copy after login

5. Unzip jdk to the current directory

cp /mnt/hgfs/linux/jdk-8u60-linux-x64.tar.gz /usr/java/
Copy after login

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
Copy after login

7. Edit the configuration file and configure the environment variables

ln -s /usr/java/jdk1.8.0_60/ /usr/jdk
Copy after login

Add the following content: JAVA_HOME according to the actual directory

vim /etc/profile
Copy after login

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
Copy after login

9. Check the installation status

sudo shutdown -r now
Copy after login
java -version
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template