The following steps are to deploy the jdk environment in the linux system
2. Create a new installation jdk folder (/usr/local/java/jdk)
cd /usr/local mkdir /usr/local/java local目录下新建java目录 cd /usr/local/java mkdir /usr/local/java/jdk 新建jdk目录 cd /usr/local/java/jdk
Decompression format: tar zxvf compressed package name
You can enter only one initial letter for the name after it, and then use the Tab button to automatically complete the full file name
eg: tar zxvf j
tar zxvf jdk-15_linux-x64_bin.tar.gz 解压
rm -f jdk-15_linux-x64_bin.tar.gz 删除压缩包
5.1 Locate the configuration file
cd /usr/local/etc find -name profile 搜索文件名为“profile”的文件 vim /etc/profile 进去profile文件
5.2 Enter the I key to switch to input mode.
5.3 Please copy the following code content and paste it into the profile file as shown (enter in front of unset i)
export JAVA_HOME=/usr/local/java/jdk/jdk-15 ------ 自己安装jdk的路径 export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar export PATH=$PATH:$JAVA_HOME/bin
5.4 Save profile and exit.
Press Esc to exit insert mode, enter: wq to save and exit
:q!
No matter edited or unedited, do not save and exit
:wq
Save and exit
5.5 File modification effective command
source /etc/profile
java -version
The above is the detailed content of How to configure the jdk environment in Linux system. For more information, please follow other related articles on the PHP Chinese website!