jdk安装脚本_JAVA_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > JAVA > jdk安装脚本

jdk安装脚本

 2014/8/5 19:50:10  liyonghui160com  程序员俱乐部  我要评论(0)
  • 摘要:#!/bin/bashchmodu+xjdk-6u29-linux-i586.bininstallPath=/usr/javaif[!-d/usr/java];thenmkdir/usr/javafi./jdk-6u29-linux-i586.bin-D/usr/javacp-Rjdk1.6.0_29//usr/java/jdk1.6.0_29/touchenvironmentecho"PATH=\"$PATH:/usr/java/jdk1.6.0_29/bin\"">>
  • 标签:

?

?

?

class="java" name="code">    #!/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

?

?

?

上一篇: 研究人员绘制牛的社交网络 下一篇: 没有下一篇了!
  • 相关文章
发表评论
用户名: 匿名