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

How to start a Vue.js project

Table of contents 1. Node.js and Vue 2. Run the f...

Vue implements sample code to disable browser from remembering password function

Find information Some methods found on the Intern...

Steps to transfer files and folders between two Linux servers

Today I was dealing with the issue of migrating a...

Rounding operation of datetime field in MySQL

Table of contents Preface 1. Background 2. Simula...

Simple principles for web page layout design

This article summarizes some simple principles of...

Example of disabling browser cache configuration in Vue project

When releasing a project, you will often encounte...

Detailed explanation of grep and egrep commands in Linux

rep / egrep Syntax: grep [-cinvABC] 'word'...

Thoughts on copy_{to, from}_user() in the Linux kernel

Table of contents 1. What is copy_{to,from}_user(...

Solution to mysql login warning problem

1. Introduction When we log in to MySQL, we often...

Install mysql5.7 on Ubuntu 18.04

Ubuntu 18.04 installs mysql 5.7 for your referenc...

Vue simulates the shopping cart settlement function

This article example shares the specific code of ...

Native JS to achieve image marquee effects

Today I will share with you a picture marquee eff...