Install java environment in Ubuntu

Install Openjdk directly through commands in ubuntu. Here I choose the default version in the system package management.

Friendly reminder: the latest version of JDK is installed

Install Openjdk

sudo apt-get install default-jre default-jdk

Configure environment variables

vim ~/.bashrc

Add the following code to the end of the .bashrc file in the file. Press first to ienter edit mode

export JAVA_HOME=/usr/lib/jvm/default-java

After inputting, press esc+ :wq!save to exit
and reload the configuration file

source ~/.bashrc

Verify that the installation is successful

java -version

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43542647/article/details/105769787