Home > Java > javaTutorial > body text

How to configure Java environment variables in Linux?

PHPz
Release: 2023-05-09 08:05:35
forward
17335 people have browsed it

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
Copy after login

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
Copy after login

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
Copy after login

5. Make the environment variables take effect

source /etc/profile
Copy after login

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!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!