sh centos_inst_java8.sh

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh centos_inst_java8.sh相关的知识,希望对你有一定的参考价值。

sudo yum remove java-1.*.0-openjdk-*

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/8u40-b25/jdk-8u40-linux-x64.rpm"
# latest
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u102-b14/jdk-8u102-linux-x64.rpm

### TODO to update
su

rpm -ivh jdk-8u40-linux-x64.rpm



alternatives --install /usr/bin/java java /usr/java/jdk1.8.0_40/bin/java 2 
alternatives --install /usr/bin/javaws javaws /usr/java/jdk1.8.0_40/bin/javaws 2 
alternatives --install /usr/bin/javac javac /usr/java/jdk1.8.0_40/bin/javac 2 
alternatives --install /usr/bin/jar jar /usr/java/jdk1.8.0_40/bin/jar 2 
alternatives --install /usr/bin/jps jps /usr/java/jdk1.8.0_40/bin/jps 2





echo "" >> /etc/profile
echo "## Setting JAVA_HOME and PATH for all USERS ##" >> /etc/profile
echo "export JAVA_HOME=/usr/java/jdk1.8.0_40" >> /etc/profile
echo "export PATH=\$PATH:\$JAVA_HOME/bin" >> /etc/profile
source /etc/profile


exit

java -version

以上是关于sh centos_inst_java8.sh的主要内容,如果未能解决你的问题,请参考以下文章

如何在CentOS 7.0 上安装Odoo 8.0

上证指数

ORACLE 11G 单实例 磁盘文件系统 DG 归档日志删除脚本 基于RED HAT LINUX 5.3 X86 64BIT

SSH远程管理服务实战

Linux下执行.sh文件

如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作