Linux virtual machine installation jdk17 - no pit version in the whole process

Table of contents

1 Turn on the virtual machine

2 Download jdk17 and put it in the directory we created

3 Unzip the file

4 Check the specific version of the installed jdk

5 Modify environment variables

6 Refresh environment variables

7 Test whether the installation is successful


1 Turn on the virtual machine

Create jdk directory 

mkdir /home/jdk17

2 Download jdk17 and put it in the directory we created

wget https://download.oracle.com/java/17/latest/jdk-17_linux-x64_bin.tar.gz -P /home/jdk17/

3 Unzip the file

tar xf /home/jdk17/jdk-17_linux-x64_bin.tar.gz -C /home/jdk17/

4 Check the specific version of the installed jdk

cd /home/jdk17/;ls

 

For example, mine is jdk-17.0.7. Be sure to remember this version number clearly. It will be used when modifying environment variables below.

5 Modify environment variables

vim /etc/profile

Note that the path of javahome is what we just set, that folder

export JAVA_HOME=/home/jdk17/jdk-17.0.7
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$JAVA_HOME/bin:$PATH

6 Refresh environment variables

source /etc/profile

7 Test whether the installation is successful

java

 

 

java -version

 

Guess you like

Origin blog.csdn.net/qq_53679247/article/details/130784450