How to configure jdk environment under Linux

How to configure jdk environment under Linux

1. Go to the official website to download the jdk package for linux, such as jdk-8u162-linux-x64.tar.gz

2. Create a directory and copy the jdk package to it, such as home/haha/user/java

3. Enter the directory in the console and execute tar zxvf jdk-8u162-linux-x64.tar.gz to decompress it.

4. Configure environment variables:

Open the console, run sudo vi /etc/profile, insert the following configuration content into the file, then save and exit (first press esc, then press :wq)

 JAVA_HOME=/home/haha/user/java/jdk1.8.0_162
 PATH=$JAVA_HOME/bin:$PATH
 CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
 export JAVA_HOME
 export PATH
 export CLASSPATH

5. Run source /etc/profile to make the environment effective

6. Enter java -version in the terminal to see if it is successful (if successful, the corresponding version number will appear).

Summarize

The above is the editor's introduction to the configuration of the JDK environment under Linux. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time!

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)
  • Detailed tutorial on installing JDK1.8 on Linux
  • Tutorial on installing jdk1.8 and configuring environment variables under Linux
  • Install JDK1.8 in Linux environment

<<:  MYSQL METADATA LOCK (MDL LOCK) MDL lock problem analysis

>>:  A brief discussion on JS packaging objects

Recommend

Detailed graphic explanation of mysql query control statements

mysql query control statements Field deduplicatio...

Implementation of Docker to build private warehouse (registry and Harbor)

As more and more Docker images are used, there ne...

Example code for converting html table data to Json format

The javascript function for converting <table&g...

MySQL 8.0 New Features: Hash Join

The MySQL development team officially released th...

How to run postgreSQL with docker

1. Install Docker. Reference URL: Docker Getting ...

Teach you how to implement Vue3 Reactivity

Table of contents Preface start A little thought ...

202 Free High Quality XHTML Templates (2)

Following the previous article 202 Free High-Qual...

VS2019 connects to mysql8.0 database tutorial with pictures and text

1. First, prepare VS2019 and MySQL database. Both...

Summary of Vue watch monitoring methods

Table of contents 1. The role of watch in vue is ...

Implementation of drawing audio waveform with wavesurfer.js

1. View the renderings Select forward: Select bac...

JS implements city list effect based on VUE component

This article example shares the specific code for...

React implements import and export of Excel files

Table of contents Presentation Layer Business Lay...

Detailed explanation of CSS sticky positioning position: sticky problem pit

Preface: position:sticky is a new attribute of CS...