sh 为Ubuntu 14.04自动安装Oracle JDK8更新92 [未测试]
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 为Ubuntu 14.04自动安装Oracle JDK8更新92 [未测试]相关的知识,希望对你有一定的参考价值。
#! /bin/bash
cd ~
# Purge OpenJDK/JRE
sudo apt-get purge openjdk-\*
# Create installation folder
sudo mkdir -p /usr/local/java
# Download JDK8
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u92-b14/jdk-8u92-linux-x64.tar.gz
# Put the compressed file inside the installation folder
sudo mv jdk-8u92-linux-x64.tar.gz /usr/local/java/
cd /usr/local/java/
# Unpack the compressed Java binaries, in the directory /usr/local/java
sudo tar xvzf jdk-8u92-linux-x64.tar.gz
# Create environment variables
sudo (echo "JAVA_HOME=/usr/local/java/jdk1.8.0_92" >> /etc/profile)
sudo (echo "JRE_HOME=$JAVA_HOME/jre" >> /etc/profile)
sudo (echo "PATH=$PATH:$JRE_HOME/bin:$JAVA_HOME/bin" >> /etc/profile)
sudo (echo "export JAVA_HOME" >> /etc/profile)
sudo (echo "export JRE_HOME" >> /etc/profile)
sudo (echo "export PATH" >> /etc/profile)
# Update the system so it is able to find the binaries
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_92/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_92/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_92/bin/javaws" 1
# Set Oracle JDK/JRE as default
sudo update-alternatives --set java /usr/local/java/jdk1.8.0_92/bin/java
sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_92/bin/javac
sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_92/bin/javaws
. /etc/profle
以上是关于sh 为Ubuntu 14.04自动安装Oracle JDK8更新92 [未测试]的主要内容,如果未能解决你的问题,请参考以下文章
sh 在Ubuntu 14.04上为开发人员计算机安装所有必需的工具
sh 在Ubuntu 14.04上安装Spark
sh 在Ubuntu 14.04上安装ElasticSearch
sh 在Ubuntu 14.04上进行rTorrent安装/更新
sh 在Ubuntu 14.04上进行rTorrent安装/更新
sh 在Ubuntu 14.04上安装Maven 3.3.3