Linux installation Oracle jdk1.8 (UBUTU)

Source: Internet
Author: User

Environment:

Ubuntu 18.04 LTS x64 bit

System User Hou

Tools:

Jdk-8u171-linux-x64.tar.gz

The heart of the experiment

Steps:

    • The first step:

To see if the JDK is installed, press and hold ctr+alt+t to open the command window input java-version

No JDK pops up with the following hint:

[email protected]:~$ java-version

Command ' Java ' not found, but can is installed with:

sudo apt install default-jre
sudo apt install openjdk-11-jre-headless
sudo apt install openjdk-8-jre-headless

Download the Linux version (version tar.gz) JDK to Oracle official website

Move the file jdk-8u65-linux-x64.gz to/home/hou/java, and unzip:

TAR-XZVF jdk-8u171-linux-x64.tar.gz

Create folder Java(I'll put it in the/home/hou/directory where I see it):

Mkdir/home/hou/java

Delete Compressed Package input instruction RM jdk-8u171-linux-x64.tar.gz

[Email protected]:~/java$
    • Step Two:

Configure environment variables, you can add to all users ' global environment variables under /etc/profile , or you can add Java environment variables for the current user environment variable ~/.BASHRC . Because I use the Ubutu attempt to modify Vi/etc/profile, the profile file is read-only without write permission, I am too lazy to add write permission to the Java environment variable added in the current user's ~/.BASHRC
Open ~/.BASHRC and edit

[email protected]:~/java$ $sudo gedit ~/.BASHRC

Add the following code at the end, note: There are no spaces at the end of the line, and spaces are resolved as paths and errors occur.

#set Java environmentexport java_home=/home/hou/java/jdk1.8. 0_171export jre_home= $JAVA _home/ jreexport CLASSPATH=.: $JAVA _home/lib: $JRE _home/lib: $CLASSPATHexport PATH= $JAVA _home/bin:$ Jre_home/bin: $PATH

As shown, make the environment variable effective immediately after saving

[email protected]:~/java$ Source ~/.BASHRC
    • Step Three:

Verify that the installation is successful

[email protected]:/$ java-version"1.8.0_171" java (TM) SE Runtime Environment (build 1.8.0_171-B11) Java HotSpot (TM) 64-bit Server VM (build 25.171-b11, mixed mode)

Summarize:

Linux installation Oracle jdk1.8 (UBUTU)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.