Configuration methods for linux system java environment variables

  • 2020-12-16 06:16:41
  • OfStack

Configure the java environment variable

Here is configuring the environment variable in etc/profile, that is, configuring the JDK environment for all users.

sudo vi /etc/profile

Configure environment variables (note the jdk location)


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

Execute an order to make it effective:

source /etc/profile

conclusion


Related articles: