Detailed explanation of installing jdk1.8 and configuring environment variables in a Linux-like environment

Detailed explanation of installing jdk1.8 and configuring environment variables in a Linux-like environment

The configuration is very simple, but I have to check it every time, so I just record it.

1. Preparation before installation

1.1 Create an installation directory. It is usually installed in the /usr/local/jdk8 directory.

mkdir /usr/local/jdk8

1.2 Check whether JDK has been installed. Delete the previous one before installation.

# Check echo $JAVA_HOME through jdk environment variables
# Check the version by java -version


1.3 Download the installation package

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz

2. Installation

2.1 Unzip and rename

tar -zxvf jdk-8u131-linux-x64.tar.gz
mv jdk1.8.0_131 jdk1.8


2.2 Configure JDK-related environment variables. The ones circled in red in the middle need to be added. Use the source command to make the configuration file take effect.

vi ~/.bashrc
export JAVA_HOME=/usr/java/latest
export PATH=$PATH:$JAVA_HOME/bin
source ~/.bashrc

2.3 Check whether the configuration is successful. If the jdk version number appears in java -version, the installation and configuration of the environment variables are successful.

You may also be interested in:
  • About Java JDK installation and configuration of environment variables
  • The process of JDK installation and configuration of environment variables under WIN10 (detailed version)
  • Linux jdk installation and environment variable configuration tutorial (jdk-8u144-linux-x64.tar.gz)
  • How to install JDK and set environment variables in Linux (this article is enough)
  • JDK13.0.1 installation and environment variable configuration tutorial with pictures and text (Win10 platform as an example)
  • win10 java (jdk installation) environment variable configuration and related issues
  • Windows 10 JDK installation and configuration environment variables and Eclipse installation tutorial
  • Tutorial on installing jdk1.8 and configuring environment variables under Linux
  • How to install Java16 JDK and set environment variables

<<:  Detailed explanation of Angular structural directive modules and styles

>>:  The latest mysql-5.7.21 installation and configuration method

Recommend

MySQL deadlock routine: inconsistent batch insertion order under unique index

Preface The essence of deadlock is resource compe...

Example analysis of MySQL startup and connection methods

Table of contents How to start mysqld Method 1: m...

Detailed explanation of Docker Swarm service orchestration commands

1. Introduction Docker has an orchestration tool ...

CSS specification BEM CSS and OOCSS sample code detailed explanation

Preface During project development, due to differ...

How to create your own Docker image and upload it to Dockerhub

1. First register your own dockerhub account, reg...

Summary of basic usage of $ symbol in Linux

Linux version: CentOS 7 [root@azfdbdfsdf230lqdg1b...

9 Tips for MySQL Database Optimization

Table of contents 1. Choose the most appropriate ...

Specific method of viewing user authorization information in mysql

Specific method: 1. Open Command Prompt 2. Enter ...

Summary of twelve methods of Vue value transfer

Table of contents 1. From father to son 2. Son to...

The correct way to migrate MySQL data to Oracle

There is a table student in the mysql database, i...

Things to note when migrating MySQL to 8.0 (summary)

Password Mode PDO::__construct(): The server requ...

Use of MySQL SHOW STATUS statement

To do MySQL performance adjustment and service st...

Explore the truth behind the reload process in Nginx

Today's article mainly introduces the reload ...