美文网首页
Fedora安装Oracle JDK

Fedora安装Oracle JDK

作者: 清梦载星河 | 来源:发表于2020-02-14 19:09 被阅读0次
    1. 下载Oracle JDK的tar.gz
    2. sudo mkdir -p /usr/local/java
    3. sudo cp -r jdk.*.tar.gz /usr/local/java
    4. sudo tar xvzf jdk-8u45-linux-x64.tar.gz
    5. 修改PATH(/etc/profile)
      sudo nano /etc/profile and paste the following at the end of the file:
    JAVA_HOME=/usr/local/java/jdk1.8.0_45
    PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
    export JAVA_HOME
    export PATH
    
    1. 向系统声明新Oracle JDK可用:

      1. sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_45/bin/java" 1
      2. sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_45/bin/javac" 1
      3. sudo update-alternatives --install "/usr/bin/javaws.itweb" "javaws.itweb" "/usr/local/java/jdk1.8.0_45/bin/javaws.itweb" 1
    2. 更改Oracle JDK为默认JDK:

      1. sudo update-alternatives --set java /usr/local/java/jdk1.8.0_45/bin/java
      2. sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_45/bin/javac
      3. sudo update-alternatives --set javaws.itweb /usr/local/java/jdk1.8.0_45/bin/javaws.itweb
    3. 使修改的/etc/profile生效:

      1. source /etc/profile
    4. 重启

    相关文章

      网友评论

          本文标题:Fedora安装Oracle JDK

          本文链接:https://www.haomeiwen.com/subject/edmjfhtx.html