“This is the second day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”

Hi, family, I’m bug bug, here I go again. Let’s talk about something today. OK, let’s continue with the Ubuntu series.

Ubuntu how to install the detailed steps in the last article has been introduced, as a Java developer, must be no stranger to JDK, so, the following is a compilation of bugs and their own practice, for everyone carefully prepared, in Ubuntu how to install JDK1.8 and configure environment variables. Listen and learn! Good cut?

I. Environmental Background

Current environment: Ubuntu20.04

Installation target: JDk1.8

Two, installation steps:

1. Download the JDK1.8 installation package

Link: Baidu network disk please input extraction code password: FB38

Or go to the Oracle Java website to download the JDK, portal

The following is the Oracle website. You can follow my screenshot annotation instructions.

Click DJK Download and the following screen will pop up.

Warm reminder: you must log in oracle account first to download the official website. If you do not have an account, you have to register an account first. It is very annoying and you have to fill in a lot of forms. Give rose, hand have lingering fragrance! Make your choice.

2. Decompress the downloaded JDK to the specified folder. Ps: I have downloaded it locally and then uploaded it to Ubuntu. I don’t need to write this step. It’s very simple. You can use rz command to upload.

sudo mkdir /usr/lib/jvm
sudo tar -zxvf jdk-8u121-linux-x64.tar.gz -C /usr/lib/jvm
Copy the code

3. After decompressing, configure environment variables.

sudo gedit ~/.bashrc
Copy the code

Append the following to the end of the.bashrc file:

#set oracle JDK environment export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_60 # JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATHCopy the code

Add the configuration as follows:

4. After the configuration is complete, run the modified initialization file again for it to take effect immediately.

source ~/.bashrc
Copy the code

Test whether the JDK is installed successfully:

java -version
javac -version
Copy the code

The JDK has been installed successfully.

6. Check the Java installation path instruction.

echo $JAVA_HOME
Copy the code

If you think this article is helpful, please don’t forget to click on the bottom left corner of the article to light it up!! If I were you, don’t hesitate to go straight to my favorites to eat ashes! No matter later use not on, first eat ash again, ha ha ha ha ha ha ha belch ~~

If you are interested in articles written by Bug bug about Ubuntu, you are welcome to subscribe to bug Bug bug’s column Ubuntu Zero-based Teaching. Bug Bug will teach you how to understand Ubuntu by hand! I use my hands to achieve your dream ~

In addition, if there are any misunderstandings in the article, please correct them more. Meanwhile, you are very welcome to leave comments below, and the bug bacteria will be the first time to reply oh ~

——————————————————————————————-

If this article has been helpful, please put your thumb in the bottom left corner of the article. (# ^. ^ #);

If you like the articles shared by Bug bug, please send bug bug a note! The danjun ‘ᴗ, you guys will have a cameo appearance with you.

If you have any questions about this article, please leave a comment below or join the group [Group number: 708072830].

In view of limited personal experience, all views and technical research points, if you have any objection, please directly reply to participate in the discussion (no offensive comments, thank you);

Copyright notice: This article is the blogger’s original article, reprint please attach the original source link and this article statement, all rights reserved, piracy will investigate! (* ^ del ^ *).