在Ubuntu 18.04 LTS上安装Oracle JDK 11

时间:2019-10-02 12:27:54

标签: ubuntu java-11

最近,oracle更改了其许可政策。我无法在ubuntu 18.04 LTS上安装oracle jdk 11。任何人都可以为此提出任何具体解决方案吗? 谢谢

2 个答案:

答案 0 :(得分:1)

我不确定您要哪个JDK,但这有几个选择:

如果要使用开源JDK 11,go to the official site and download and install the .deb file

如果您需要OpenJDK 11,go to the official site and download the .tar.gz file。然后extract it to a location you want and set the environment variables

答案 1 :(得分:0)

我创建了要点来帮助解决这个特定问题:https://gist.github.com/Thoughtscript/d5cdba8013a006dbbd2899e899b95146

下面部分重复。我花了一段时间,但可以通过下面的jdk.java.net链接使用OpenJDK-11.0.2。

NOTE It's recommended to download Java 11+ directly from Oracle. It's further recommended to use the OpenJDK 11.0.2 (and avoid other options).
See: https://jdk.java.net/archive/

sudo apt-get update
wget "https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz"
sudo tar -xzvf openjdk-11.0.2_linux-x64_bin.tar.gz
sudo mv jdk-11.0.2 /usr/lib/jvm/

# Config
sudo nano /etc/environment

# Add the line below
# JAVA_HOME="/usr/lib/jvm/jdk-11.0.2/"

# Config
sudo nano ~/.bashrc
# Add the lines below
# JAVA_HOME=/usr/lib/jvm/jdk-11.0.2/
# PATH=$JAVA_HOME/bin:$PATH
source ~/.bashrc

# Verify
echo $JAVA_HOME
javac --version
相关问题