Alibaba Cloud ECS install jdk environment

1. Enter orcle official website
2. Select the version that needs to be downloaded, and download requires agreement to orcle agreement
Insert picture description here

3. Get the download link URL and download the cookie
Insert picture description here
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

Insert picture description here
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
Insert picture description here

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 xshellis ok , but the paid software cannot be installed on the company computer.

I discovered today that Anconda Terminalcan also connect to the server. Because it is also a web version, it is a pity that Esc still conflicts.

Insert picture description here
Finally, use the VScodeconnected 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

Guess you like

Origin blog.csdn.net/qq_35866846/article/details/111476716