Linux jdk installation and environment variable configuration tutorial (jdk-8u144-linux-x64.tar.gz)

Linux jdk installation and environment variable configuration tutorial (jdk-8u144-linux-x64.tar.gz)

It is recommended to use the sudo su command to switch to the root account first, otherwise you may not have permission to operate the /opt directory later.

1. Download and decompress

First go to the official website to download the compressed package jdk-8u144-linux-x64.tar.gz.

After downloading, enter cp jdk-8u144-linux-x64.tar.gz /opt in the terminal to copy the compressed package to the opt directory.
Then go to the opt directory and enter tar -zxvf jdk-8u144-linux-x64.tar.gz to decompress it.

2. Edit the profile file in the etc directory

sudo vi /etc/profile Use the vi command to edit the profile file in the /etc directory. Press i to enter the editing mode. Use the up, down, left, and right keys on the keyboard to move the cursor to the last line as shown in the figure. Add the following to the last line: export JAVA_HOME=/opt/jdk

insert image description here

Press the Esc key to exit edit mode and return to command line mode.
Enter :x to save and exit.

3. Create and edit the java.sh file in the etc/profile.d directory

cd /etc/profile.d Enter the directory
sudo vi java.sh Create the java.sh file and edit it (press i to enter the editing mode)

java.sh edit content:
(You need to write it according to the path here. First go to the opt directory and copy the unzipped path. The displayed path is /opt/jdk1.8.0_144 )

export JAVA_HOME=/opt/jdk1.8.0_144
export PATH=$PATH:/opt/jdk1.8.0_144/bin 

insert image description here

Enter :x to save and exit.

4. Source the global configuration file /etc/profile to check whether the configuration is successful

source /etc/profile global configuration file (if a normal user switches to the root user, enter this command and the previous configuration steps do not need to be repeated)

Use java -version to check whether the configuration is successful. If successful, the result is as shown below:

insert image description here

Summarize

This is the end of this article about Linux jdk installation and environment variable configuration tutorial (jdk-8u144-linux-x64.tar.gz). For more related Linux jdk installation and environment variable configuration (jdk-8u144-linux-x64.tar.gz) content, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to install JDK and set environment variables in Linux (this article is enough)
  • How to configure jdk environment under Linux
  • Detailed tutorial on installing JDK1.8 on Linux
  • Tutorial on installing jdk1.8 and configuring environment variables under Linux
  • Install JDK1.8 in Linux environment

<<:  Cross-domain issues in front-end and back-end separation of Vue+SpringBoot

>>:  MYSQL master-slave replication knowledge points summary

Recommend

Web Design Experience

<br />The author used to be a novice in web ...

Complete steps to install Anaconda3 in Ubuntu environment

Table of contents Introduction to Anaconda 1. Dow...

Docker swarm simple tutorial

swarm three virtual machines 132,133,134 1. Initi...

Detailed explanation of Nginx static file service configuration and optimization

Root directory and index file The root directive ...

Summary of MySQL log related knowledge

Table of contents SQL execution order bin log Wha...

Several ways to hide Html elements

1. Use CSS Copy code The code is as follows: style...

Baidu Input Method opens API, claims it can be ported and used at will

The relevant person in charge of Baidu Input Metho...

Problems and solutions for installing Docker on Alibaba Cloud

question When installing Docker using Alibaba Clo...

Vue complete code to implement single sign-on control

Here is a Vue single sign-on demo for your refere...

How to use watch listeners in Vue2 and Vue3

watch : listen for data changes (change events of...

Detailed explanation of Windows time server configuration method

Recently, I found that the company's server t...

7 Ways to Write a Vue v-for Loop

Table of contents 1. Always use key in v-for loop...

Linux type version memory disk query command introduction

1. First, let’s have a general introduction to th...