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

A guide to writing flexible, stable, high-quality HTML and CSS code standards

The Golden Rule Always follow the same set of cod...

How to run top command in batch mode

top command is the best command that everyone is ...

Analysis of MySQL crash recovery based on Redo Log and Undo Log

Table of contents MySQL crash recovery process 1....

How to install Graphviz and get started tutorial under Windows

Download and installConfigure environment variabl...

Solution to 1067 when Mysql starts in Windows

I just started working a few days ago and install...

Introduction to using MySQL commands to create, delete, and query indexes

MySQL database tables can create, view, rebuild a...

MySQL 8.0.12 installation and configuration graphic tutorial

Recorded the download and installation tutorial o...

How to use Spark and Scala to analyze Apache access logs

Install First you need to install Java and Scala,...

Introduction to general_log log knowledge points in MySQL

The following operation demonstrations are all ba...

How to Install Oracle Java 14 on Ubuntu Linux

Recently, Oracle announced the public availabilit...

Mobile Internet Era: Responsive Web Design Has Become a General Trend

We are in an era of rapid development of mobile In...

A detailed introduction to Tomcat directory structure

Open the decompressed directory of tomcat and you...

How to implement Linux deepin to delete redundant kernels

The previous article wrote about how to manually ...