Linux安装jdk

1,创建文件夹
  mkdir -p /usr/local/java 并进入文件夹 cd /usr/local/java
2,下载jdk压缩包  
  wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
3,解压
  tar -zxvf jdk-8u141-linux-x64.tar.gz
4,配置环境变量
   vi /etc/profile
  然后再文件末尾添加
  export JAVA_HOME=/usr/local/java/jdk1.8.0_141
  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,刷新环境变量文件
  source /etc/profile
6,验证
  java -version
posted on 2020-04-09 11:00  看,那深蓝  阅读(139)  评论(0编辑  收藏  举报