linux部署java环境

1. 网址:https://repo.huaweicloud.com/java/jdk/8u191-b12/
        https://repo.huaweicloud.com/java/jdk/8u191-b12/jdk-8u191-linux-x64.tar.gz

2. mkdir -p /usr/local/java
   在目录/usr/local/java:tar -xvzf  jdk-8u191-linux-x64.tar.gz

3. 修改配置文件:vim /etc/profile 
   写入配置:
   export JAVA_HOME=/usr/local/jdk1.8.0_271 #这里写自己的路径	
   export JRE_HOME=${JAVA_HOME}/jre
   export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
   export PATH=.:${JAVA_HOME}/bin:$PATH

4. source /etc/profile

5. java -version

若以上不成功则:

1. vim ~/.bashrc

export JAVA_HOME=/usr/local/java/jdk1.8.0_191
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

2. source ~/.bashrc
3. java -version
-------------------------successful!
root@deploy-hl-zxw1:/usr/local/java/jdk1.8.0_191# java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)

posted @ 2022-07-06 19:17  GEGEWU-  阅读(260)  评论(0编辑  收藏  举报