linux下jdk一键安装包jdk一键安装包ubuntu12.04下jdk1.8一键安装包CentOS下jdk1.8一键安装包
 
有时候在linux下装个 jdk 好鬼麻烦,接下来我献上我弄好的jdk一键安装包。
 
本次搞的是jdk1.8的linux下一键安装包,分Ubuntu和CentOS,如果要装低版本的jdk只需下载个jdk然后在脚本中修改下名字即可。
 
 
1、首先献上的是Ubuntu的一键安装包


#!/bin/sh

TOP_DIR=$(cd $(dirname "$0") && pwd)

###### ubuntu安装JDK 1.8 #######
mkdir /usr/lib/java
cp $TOP_DIR/jdk-8u40-linux-x64.tar.gz /usr/lib/java/
chmod u+x /usr/lib/java/jdk-8u40-linux-x64.tar.gz
cd /usr/lib/java/
tar -zxvf jdk-8u40-linux-x64.tar.gz

rm -f /usr/lib/java/jdk-8u40-linux-x64.tar.gz

echo "export JAVA_HOME=/usr/lib/java/jdk1.8.0_40" >> /etc/bash.bashrc
echo "export JRE_HOME=/usr/lib/java/jdk1.8.0_40" >> /etc/bash.bashrc
echo "export PATH=\$JAVA_HOME/bin:\$JAVA_HOME/jre/bin:\$PATH" >> /etc/bash.bashrc
echo "export CLASSPATH=\$CLASSPATH:.:\$JAVA_HOME/lib:\$JAVA_HOME/jre/lib" >> /etc/bash.bashrc

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/java/jdk1.8.0_40/bin/java" 300
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/java/jdk1.8.0_40/bin/javac" 300
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/java/jdk1.8.0_40/bin/javaws" 300
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws
echo ""
echo ""
echo ""
echo "ubuntu jdk8 install done, and now will run 'java -version'"
echo ""
java -version
echo ""
echo ""
echo ""
echo "thank you use jdk install shell."

 
 
2、接下来是CentOS的jdk一键安装包,jdk1.8

#!/bin/sh

TOP_DIR=$(cd $(dirname "$0") && pwd)

###### centos安装JDK #######
mkdir /usr/java
cp $TOP_DIR/jdk-8u40-linux-x64.tar.gz /usr/java/
chmod u+x /usr/java/jdk-8u40-linux-x64.tar.gz
cd /usr/java/
tar -zxvf jdk-8u40-linux-x64.tar.gz

rm -f /usr/java/jdk-8u40-linux-x64.tar.gz

echo "export JAVA_HOME=/usr/java/jdk1.8.0_40" >> /etc/profile
echo "export JRE_HOME=/usr/java/jdk1.8.0_40" >> /etc/profile
echo "export PATH=\$JAVA_HOME/bin:\$JAVA_HOME/jre/bin:\$PATH" >> /etc/profile
echo "export CLASSPATH=\$CLASSPATH:.:\$JAVA_HOME/lib:\$JAVA_HOME/jre/lib" >> /etc/profile

update-alternatives --install "/usr/bin/java" "java" "/usr/java/jdk1.8.0_40/bin/java" 300
update-alternatives --install "/usr/bin/javac" "javac" "/usr/java/jdk1.8.0_40/bin/javac" 300
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/java/jdk1.8.0_40/bin/javaws" 300
update-alternatives --config java
update-alternatives --config javac
update-alternatives --config javaws
echo ""
echo ""
echo ""
echo "centos jdk8 install done, and now will run 'java -version'"
echo ""
java -version
echo ""
echo ""
echo ""
echo "thank you use jdk install shell."


 
 
把上面相应的脚本保存下来,上传到linux中,给予可执行权限【chmod +x XXXXX.sh】,然后执行 ./XXXXX.sh 即可以。
 
 
下面奉上jdk1.8与一键安装包的百度云地址,点击如下下载按钮:
 

jdk1.8与一键安装包下载

jdk与安装包百度云地址 百度云提取密码:6ehc

 
 

如百度云链接失效,请发个邮件给我,就说要jdk1.8安装包的就行,我的邮箱:it@cfei.net