jdk安装脚本
#!/bin/bash chmod u+x jdk-6u29-linux-i586.bin installPath=/usr/java if [ ! -d /usr/java ]; then mkdir /usr/java fi ./jdk-6u29-linux-i586.bin -D /usr/java cp -R jdk1.6.0_29/ /usr/java/jdk1.6.0_29/ touch environment echo "PATH=\"$PATH:/usr/java/jdk1.6.0_29/bin\"" >> environment echo "JAVA_HOME=/usr/java/jdk1.6.0_29" >> environment echo "CLASSPATH=.:%JAVA_HOME%/lib/dt.jar:%JAVA_HOME%/lib/tools.jar" >> environment rm -rf /etc/environment cp environment /etc source /etc/environment update-alternatives --install /usr/bin/java java /usr/java/jdk1.6.0_29/bin/java 300 update-alternatives --install /usr/bin/javac javac /usr/java/jdk1.6.0_29/bin/javac 300 update-alternatives --config java
#!/bin/bash # echo "You want to which kinds of means to install jdk:" select jdk in `ls *gz *bin` do echo "Your choice is $jdk" break done echo "According to your chosen bag suffixes to choice,eg:bin" echo "Usage:Please input bin or gz:" read -p "You jdk type is App>" type case $type in bin) chmod +x $jdk sh $jdk ;; gz) tar -zxvf $jdk ;; esac ls jdk* -d|while read jdkfile;do appjdk=(`echo $jdkfile`) size=${#jdkfile[@]} for ((i=0;i<$size;i++)) do if [ -d ${appjdk[$i]} ];then mv ${appjdk[$i]} /opt/oracle/ echo -e "JAVA_HOME=/opt/oracle/"${appjdk[$i]}"" >> /etc/profile echo -e "JAVA_BIN=/opt/oracle/"${appjdk[$i]}"/bin" >> /etc/profile echo -e "PATH=$PATH:$JAVA_BIN" >> /etc/profile echo -e "CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar" >> /etc/profile export JAVA_HOME JAVA_BIN PATH CLASSPATH source /etc/profile echo "Now we'll test about whether it's ok!" java -version echo " " if [ $? == 0 ];then echo "You see,jdk is installed successfully!" else echo "Please check where did jdk go wrong!!!" fi fi done done
相关推荐
吴家应 2020-03-02
laisean 2020-11-11
Julyth 2020-10-16
laisean 2020-09-27
flycappuccino 2020-09-27
liguojia 2020-09-27
87201442 2020-10-15
MXstudying 2020-09-05
WasteLand 2020-09-15
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh
mathchao 2020-09-15
tvk 2020-07-30
Zaratustra 2020-07-29
zhaowj00 2020-07-26
Zaratustra 2020-06-26
ldcwang 2020-06-25
拿什么来拯救自己 2020-06-21
IsanaYashiro 2020-06-16
赵家小少爷 2020-06-14