centOS安装java
centOS安装java
rpm -qa |grep java # 查看已经安装的java rpm -e java.... # 删除已经安装的java rpm -y list java... # 查看已有的资源 rpm -y install java... # 安装指定的资源
然后,这样安装的没有javac啊;
wget http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz?AuthParam=1535152209_f6c5a52037eea9a4734f0e1b766a0a57 mv jdk-8u181-linux-x64.tar.gz\?AuthParam\=1535152209_f6c5a52037eea9a4734f0e1b766a0a57 jdk-8u181-linux-x64.tar.gz tar -xvzf jdk-8u181-linux-x64.tar.gz
[root@localhost java]#vim /etc/profile
在最后一行加上如下值
#java environment
export JAVA_HOME=/usr/java/jdk1.7.0_80
export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jar
export PATH=$PATH:${JAVA_HOME}/bin
注:CentOS6上面的是JAVAHOME,CentOS7是{JAVA_HOME}