Centos7.9_Solve the problem that the java environment variables configured every time the machine is restarted need to re-source /etc/profile to take effect---Linux Work Notes 060

    In this case, you need to put environment variables and java environment variables in the /root/.bashrc file. Note that this file is hidden. By default, you need to execute ls -a to display it.

 

#jdk
export JAVA_HOME=/lib/jvm
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
# User specific aliases and functions

You can see that when configuring environment variables, you need to configure them in the above way. This configuration file

Then, after each startup, the environment variable will automatically take effect 

Guess you like

Origin blog.csdn.net/lidew521/article/details/132217449