1. Enter orcle official website
2. Select the version that needs to be downloaded, and download requires agreement to orcle agreement
3. Get the download link URL and download the cookie
4. Use the wget command to download the compressed package
wget --no-cookies --no-check-certificate --header 'Cookie:你自己的cookie' https://download.oracle.com/otn-pub/java/jdk/15.0.1+9/51f4f36ad4ef43e39d0dfdbaf6549e32/jdk-15.0.1_linux-x64_bin.tar.gz
5. Unzip
tar -zxvf jdk-15.0.1_linux-x64_bin.tar.gz
6. Test and view version
cd jdk-15.0.1/bin
./java -version
The execution result is as shown below, the installation is complete
7. Configure environment variables to the system directory
# 切换到环境根目录
cd ..
# 查看当前路径 并复制
pwd
# 根目录下的profile配置环境变量
# 编辑配置文件
vi ~/.bash_profile
Press i to enter the editing mode, enter the following
# 注意=两边不能有空格
export JAVA_HOME=/root/software/jdk-15.0.1
export PATH=$JAVA_HOME/bin:$PATH
esc exit edit mode
# 保存并退出
:wq
Note here:
the esc directly connected to the Alibaba Cloud webpage will fail because it conflicts with the system hotkey (it took a day to find the reason and solve it)
Try to use other connectors to connect to Alibaba Cloud. It xshell
is ok , but the paid software cannot be installed on the company computer.
I discovered today that Anconda Terminal
can also connect to the server. Because it is also a web version, it is a pity that Esc still conflicts.
Finally, use the VScode
connected server to get it
pycharm
The professional version is also available. Mine is the community version. There is no test. You can connect directly to the developer of the tools
8. Make the configuration file effective
source ~/.bash_profile
echo $JAVA_HOME
# 测试
cd ~
java -version