How to install jdk in linux

王林
王林Original
2019-12-03 14:44:487281browse

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
rrree

4. Change jdk-8u60-linux -x64.tar.gzCopy 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!

Statement:
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