Install JDK1.8 in Linux environment

Install JDK1.8 in Linux environment

This article mainly introduces how to install JDK in Linux environment. Because Java is often indispensable in Linux environment, the author will share with you the process of jdk1.8.

1. Installation Environment

Operating system: Red Hat Enterprise Linux 6 64-bit (version 6.6)

JDK version: 1.8

Tools: Xshell5, Xftp5

Note: This article uses the Xshell5 tool to remotely connect to Linux for operation. It would be more convenient if you operate directly in the Linux visual interface. The principle is the same.

2. Installation steps

Step 1: Download the installation package

Download jdk1.8 in Linux environment, please go to (official website) to download the jdk installation file;

Since my Linux is 64-bit, I download jdk-8u131-linux-x64.tar.gz.

As shown in the following figure:

If Linux itself is connected to the Internet, we can directly download the JDK installation package through the wget command, as shown in the figure:

If there is no external network environment, still install the above method to download the installation package, and then upload it to the server

Step 2: Unzip the installation package

Upload the downloaded JDK installation package to the server and decompress it

Decompression command to decompress

1 $ cd /home/xxxxxxxx
2 $ tar -zxvf jdk-8u131-linux-x64.tar.gz 

After the decompression is complete, you can see a directory named [jdk1.8.0_131] in the current directory, which contains relevant files

We need to move all the data in the unzipped [jdk1.8.0_131] to the folder we need to install. We plan to install jdk in usr/java. We create a new java folder in the usr directory.

mkdir /usr/java

Copy the data in [jdk1.8.0_131] to the java directory

mv /home/xxxxxxxx/jdk1.8.0_131 /usr/java 

Step 3: Modify environment variables

At this point, we finally need to modify the environment variables through the command

vim /etc/profile

Use the vim editor to edit the profile file and add the following content to the end of the file (press "i" to enter the editing):

export JAVA_HOME=/usr/java/jdk1.8.0_131
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}

As shown in the figure:

Then, save and exit (press: wq!)

After saving, we also need to make this environment variable configuration information take effect, otherwise we can only restart the computer to take effect.

Use the command source /etc/profile to make the profile file take effect immediately, as shown in the figure

Step 4: Test whether the installation is successful

  • ①. Use the javac command, and there will be no command not found error
  • ②、Use java -version, the version displayed is java version "1.8.0_131"
  • ③、echo $PATH to see if the environment variables you just set are configured correctly

As shown in the figure:

At this point, the installation is complete

This concludes this article about installing JDK1.8 in Linux environment. I hope it will be helpful for everyone’s study, and I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • 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)
  • 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

<<:  CSS3 flexible box flex to achieve three-column layout

>>:  In-depth understanding of javascript prototype and prototype chain

Recommend

Ubuntu 19.10 enables ssh service (detailed process)

It took me more than an hour to open ssh in Ubunt...

In-depth analysis of JDBC and MySQL temporary tablespace

background Temporary tablespaces are used to mana...

Solve the problem that await does not work in forEach

1. Introduction A few days ago, I encountered a p...

Disable autocomplete in html so it doesn't show history

The input box always displays the input history wh...

Install CentOS system based on WindowsX Hyper-V

At present, most people who use Linux either use ...

Detailed explanation of the failure of MySQL to use UNION to connect two queries

Overview UNION The connection data set keyword ca...

How to implement dual-machine master and backup with Nginx+Keepalived

Preface First, let me introduce Keepalived, which...

Use Docker to build a Git image using the clone repository

Overview I have been using Docker for more than a...

Detailed explanation of Vue's TodoList case

<template> <div id="root"> ...

Style trigger effect of web page input box

<br />This example mainly studies two parame...

Introduction to install method in Vue

Table of contents 1. Globally registered componen...

Vue implements tab label (label exceeds automatic scrolling)

When the created tab label exceeds the visible ar...

MySQL trigger detailed explanation and simple example

MySQL trigger simple example grammar CREATE TRIGG...