Home  >  Article  >  Java  >  How to install java environment in centos

How to install java environment in centos

WBOY
WBOYforward
2023-05-27 13:58:062808browse

1. Centos description

Linux is an operating system. Centos, Fedora, and RedHat can be understood as "brands." The core of the operating systems of these "brands" are all Linux systems, but You may make some extensions and add some of your own features.

2. Installation steps

(1) First, transfer the linux version of java8 compressed package to linux via ftp On the server

(2)Create the installation directory

mkdir /usr/java/

(3)Extract to the installation directory

tar -zxvf jdk-8u171-linux-x64.tar.gz -C /usr/java/

(4)Set the environment variable

Open the file

vim /etc/profile

Add

export JAVA_HOME=/usr/java/jdk1.8.0_171
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH

at the end to make the environment variable take effect

source /etc/profile

The above is the detailed content of How to install java environment in centos. 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