Ali ECS install JDK

1. First see if you have pre-installed jdk (you can install an Xshell 5 first, or use Ali's remote connection). The xshell xftp installation file can be downloaded here:  https://download.csdn.net/download/tianyueWindbg/15535309

java -version

If you have installed jdk, you can use it directly, if the version is wrong, you can uninstall it and install it again. Unfortunately, my ECS is not pre-installed, and it is not uninstalled. Sometimes you don't have permission to uninstall Times, use su root to switch to root user.

Search: rpm -qa | grep java

Uninstall: rpm -e --nodeps XXX (installed jdk)

2. Download JDK 

  Download the current latest version: http://www.oracle.com/technetwork/java/javase/downloads/index.html

  Historical version download address: http://www.oracle.com/technetwork/java/javase/archive-139210.html   

3. Download the required JDK to the local.

4. Create a java folder in ECS. Switch to the folder where you want to put java. I put cd /opt under opt.

mkdir java

5. Use xftp to upload the downloaded JDK file to the java folder. To install xftp first.

 

6. Unzip jdk 

tar -zxvf  jdk.tar.gz

7. Set environment variables: vim /etc/profile Open the profile file. Click "insert" to open the edit mode and add at the end of the file:

export JAVA_HOME=/opt/java/jdk1.8.0_271
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin

Enter "Shift +:", wq exit

8. source /etc/profile restart configuration

9. java -version Check whether the installation is successful. The following installation is successful;

 


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/tianyueWindbg/article/details/114292990