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 green version setting code and 1067 error details

MySQL green version setting code, and 1067 error ...

docker logs - view the implementation of docker container logs

You can view the container logs through the docke...

MySQL full backup and quick recovery methods

A simple MySQL full backup script that backs up t...

Detailed explanation of docker network bidirectional connection

View Docker Network docker network ls [root@maste...

Steps to restore code from a Docker container image

Sometimes the code is lost and you need to recove...

The most complete package.json analysis

Table of contents 1. Overview 2. Name field 3. Ve...

How to solve the DOS window garbled problem in MySQL

The garbled code problem is as follows: The reaso...

Docker nginx + https subdomain configuration detailed tutorial

Today I happened to be helping a friend move his ...

MySQL 5.7.17 installation and configuration tutorial under Linux (Ubuntu)

Preface I have installed MySQL 5.6 before. Three ...

Implementing a simple timer in JavaScript

This article example shares the specific code of ...

JS ES new features: Introduction to extension operators

1. Spread Operator The spread operator is three d...

Table setting background image cannot be 100% displayed solution

The following situations were discovered during d...

Json advantages and disadvantages and usage introduction

Table of contents 1. What is JSON 1.1 Array liter...