Referring to Ask Ubuntu question How to set JAVA_HOME for OpenJDK?
(请参阅询问Ubuntu问题如何为OpenJDK设置JAVA_HOME?)
, (,)
How to install Open JDK
(Java developement kit) in Ubuntu (Linux)?
(如何在Ubuntu(Linux)中安装Open JDK
(Java开发工具)?)
Open Terminal from Application Dash or press Ctrl + Alt + T
(从Application Dash打开终端或按Ctrl + Alt + T)
Update repository:
(更新存储库:)
sudo add-apt-repository ppa:openjdk-r/ppa # only Ubuntu 17.4 and earlier sudo apt update
Optional: To search available distributions of openjdk
, use the following command:
(可选:要搜索openjdk
可用发行版,请使用以下命令:)
apt search openjdk
Install the appropriate version with the following command:
(使用以下命令安装适当的版本:)
sudo apt install openjdk-8-jdk sudo apt install openjdk-8-source #this is optional, the jdk source code
For JAVA_HOME
(Environment Variable) type command as shown below, in "Terminal" using your installation path...
(对于JAVA_HOME
(环境变量),请使用安装路径在“终端”中键入如下所示的命令...)
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
(Note: /usr/lib/jvm/java-8-openjdk
is symbolically used here just for demostration. You should use your path as per your installation.)
((注意: /usr/lib/jvm/java-8-openjdk
在这里只是象征性地用于演示。您应该在安装时使用路径。))
For PATH
(Environment Variable) type command as shown below, in Terminal
:
(对于PATH
(环境变量),在Terminal
输入如下所示的命令:)
export PATH=$PATH:$JAVA_HOME/bin
To check your installation:
(要检查您的安装:)
java -version
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…