linux 下安装jdk

2017-07-15  本文已影响83人  孤舟远行

卸载已安装的open jdk[1][2]

copy-jdk-configs-1.2-1.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
javapackages-tools-3.4.1-11.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
tzdata-java-2017b-1.el7.noarch
javamail-1.4.6-8.el7.noarch
rpm -e --nodeps copy-jdk-configs-1.2-1.el7.noarch
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.131-3.b12.el7_3.x86_64
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64
如果卸载对应后继续运行卸载该命令,会出现以下提示:
error: package java-1.8.0-openjdk-1.8.0.131-3.b12.el7_3.x86_64 is not installed

安装JDK[1]

ubuntu:

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/8u144-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz?AuthParam=1504071462_ada46b0cca620eea37f1524f3d72847f"
java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)
export JAVA_HOME=/usr/java/jdk1.8.0_131
export PATH=$PATH:$JAVA_HOME
  1. 按下esc
  2. 输入冒号:,然后输入wq保存修改并且推出即可

或者:

echo 'export JAVA_HOME="/opt/jdk1.8.0_144"
export PATH="$JAVA_HOME/bin:$JAVA_HOME/jre:$PATH"' >> ~/.bashrc
上一篇下一篇

猜你喜欢

热点阅读