ubuntu20.04中,安装jdk,配置环境变量

  1. 下载jdk
    https://www.oracle.com/java/technologies/downloads/

  2. 创建目录
    sudo mkdir /usr/lib/jvm

  3. 解压缩到该目录
    sudo tar -zxvf jdk-7u60-linux-x64.gz -C /usr/lib/jvm

  4. 修改环境变量
    sudo vim ~/.bashrc

    #set oracle jdk environment
    export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_201
    export JRE_HOME= J A V A H O M E / j r e e x p o r t C L A S S P A T H = . : {JAVA_HOME}/jre export CLASSPATH=.: JAVAHOME/jreexportCLASSPATH=.:{JAVA_HOME}/lib: J R E H O M E / l i b e x p o r t P A T H = {JRE_HOME}/lib export PATH= JREHOME/libexportPATH={JAVA_HOME}/bin:$PATH

  5. 使环境变量马上生效
    source ~/.bashrc

你可能感兴趣的:(ubuntu,ubuntu,linux)