Home  >  Article  >  Java  >  How to configure Java environment variables in Linux?

How to configure Java environment variables in Linux?

PHPz
PHPzforward
2023-05-09 08:05:3517344browse

1. Download JavaSDK.

(1) Download JDK

(2) Select the access permission agent in Java SE Development Kit 8u144.

(3) Select the version suitable for your operating system to download.

2. Upload jkd to the linux server.

Use the rz command

rz

3. Unzip the jdk installation package

tar -zxvf compressed file (unzip the installation package to this directory Next)

tar -zxvf compressed file -C Specify directory path (unzip the installation package to the specified directory)

4. Edit the environment variable configuration file

vi /etc/profile

Add three environment variables at the end of the file

export JAVA_HOME=/java/jdk1.8.0_111(改为jdk解压后文件所在目录)
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

5. Make the environment variables take effect

source /etc/profile

The above is the detailed content of How to configure Java environment variables in Linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete