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

Using Docker+jenkins+python3 environment to build a super detailed tutorial

Preface: After the automation is written, it need...

Summary of CSS counter and content

The content property was introduced as early as C...

MySQL and MySQL Workbench Installation Tutorial under Ubuntu

Ubuntu install jdk: [link] Install Eclipse on Ubu...

Detailed explanation of this pointing in JS arrow function

Arrow function is a new feature in ES6. It does n...

A brief discussion on Flink's fault-tolerant mechanism: job execution and daemon

Table of contents 1. Job Execution Fault Toleranc...

CSS3+Bezier curve to achieve scalable input search box effect

Without further ado, here are the renderings. The...

How to shut down/restart/start nginx

closure service nginx stop systemctl stop nginx s...

Ubuntu 15.04 opens mysql remote port 3306

Ubuntu 15.04 opens MySQL remote port 3306. All th...

Detailed explanation of asynchronous iterators in nodejs

Table of contents Preface What are asynchronous i...

Vue implements form data validation example code

Add rules to the el-form form: Define rules in da...

The past two years with user experience

<br />It has been no more than two years sin...

Summary of Vue's cross-domain problem handling and solutions

When you send a network request, the following sa...

12 Laws of Web Design for Clean Code [Graphic]

Beautiful code is the foundation of a beautiful we...

Detailed explanation of several methods of JS array dimensionality reduction

Dimensionality reduction of two-dimensional array...

MYSQL Operator Summary

Table of contents 1. Arithmetic operators 2. Comp...