[Software installation] Install JDK1.8 operating environment in Linux system (Ubuntu system)

This article mainly introduces the installation of the JDK1.8 operating environment (Ubuntu system) in the Linux system.

Table of contents

1. Linux installation JDK operating environment

1.1. Download the JDK installation package

1.2. Upload JDK to Linux server

1.3. Decompress the JDK installation package

1.4. Configure JDK environment variables

1.5. Reload the profile environment variable

1.6. Check whether the configuration is successful


1. Linux installation JDK operating environment

1.1. Download the JDK installation package

Here is how to install the JDK1.8 operating environment in the Linux system. First, you need to download the JDK1.8 installation package, which can be downloaded from the Oracle official website. The official website download address:【https://www.oracle.com/java/technologies/downloads /#java8 ], as shown in the figure below.

You need to log in to the Oracle account to download from the Oracle official website. If you do not have an Oracle account, you can also go to some domestic mirror libraries to download, for example: download JDK from the Huawei Cloud mirror library, the download address is https://repo.huaweicloud.com/java/jdk / ], as shown below.

1.2. Upload JDK to Linux server

After the JDK installation package is downloaded, you can upload it to the Linux system. You can use FTP, WinSCP and other tools to upload it. Upload the installation package to a certain directory on the Linux server. Just create a directory and save the file yourself. Here I uploaded it to the [/home/jdk1.8] directory, as follows:

1.3. Decompress the JDK installation package

After the JDK compressed package is uploaded to the Linux server, you can enter the [/home/jdk1.8] directory and execute the [tar -xvf jdk-8u202-linux-x64.tar.gz] decompression command.

1.4. Configure JDK environment variables

After decompression, jdk is basically installed successfully. In order to be able to use the jdk command in any directory, you need to configure the environment variable of jdk here. Execute the [vi /etc/profile] command to open the environment variable configuration file . Add the configuration content of the jdk environment variable at the end of the file.

The configuration code looks like this:

# 配置jdk环境变量
export JAVA_HOME=/home/jdk1.8/jdk1.8.0_202
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:${PATH}

1.5. Reload the profile environment variable

Execute the [source /etc/profile] command to reload the environment variables. If the error message bash: etc/profile: Permission denied is reported when executing the command, this is because the permissions of the /etc/profile file are not enough. The solution is: modify /etc/ Profile directory access rights, execute the command [chmod +x /etc/profile] , and then re-execute the [source /etc/profile] command.

1.6. Check whether the configuration is successful

In any directory, execute the [java -version] command to view the jdk version. If the version information can be displayed normally, it means that the jdk environment variable configuration is successful.

At this point, the Linux system installation JDK1.8 operating environment is introduced.

In summary, this article is over, mainly introducing the installation of JDK1.8 operating environment (Ubuntu system) in the Linux system.

Guess you like

Origin blog.csdn.net/qq_39826207/article/details/131425549