zoukankan      html  css  js  c++  java
  • linux安装配置JDK脚本

    #!/bin/bash
    # install jdk and configuring environment variables
    function installjdk(){
    tar -zxf jdk-8u201-linux-x64.tar.gz -C /usr/local
    cat >> /etc/profile << EOF
    export JAVA_HOME=/usr/local/jdk1.8.0_201
    export PATH=$PATH:$JAVA_HOME/bin
    export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    EOF
    }
    
    #-------------------------- testing jdk--------------------------
    echo "========= Start to install JDK =============="
    source /etc/profile
    if [ -n "$JAVA_HOME" ];then
    echo "JDK already installed"
    java -version
    else
    if [ -f "./jdk-8u201-linux-x64.tar.gz" ];then
      installjdk
      source /etc/profile
      java -version
      echo "use the 'source /etc/profile' command to update local variables"
    else
      echo "Missing 'jdk-8u201-linux-x64.tar.gz' file in statistical catalogue"
      echo "Failed to install JDK"
    fi
    fi
    echo "========= End installation of JDK ==========="
  • 相关阅读:
    PHP PDO
    常用JavaScript字符串方法简述
    命名
    jquery远程班备忘
    html历史
    CSS3的翻转效果
    正则
    排序算法
    firebug的调试,console
    跨域
  • 原文地址:https://www.cnblogs.com/donfaquir/p/10540795.html
Copyright © 2011-2022 走看看