Problem restore: As we all know, to modify the global configuration of CentOS, you can modify the/etc/profile file, for example, I need to modify the Java_home variable, so in general we just change in it, source a bit on the line.
But the situation I encountered this time is: View/etc/profile, Java_home path, and I modified the new path is consistent,
Use $java_home to view, such as:
But the problem came, and after a while, I jumped to another similar but different directory:
After troubleshooting, the problem is found:./BASHRC in this file,
. BASHRC: This file primarily stores personal personalization settings, such as command aliases, paths, and so on. That is, on the same server, it is only relevant to the personalization settings of a user.
The. BASHRC is typically called explicitly in the. bash_profile file. When you log in to Linux to start bash, you will first read the ~/.bash_profile file so that ~/.BASHRC is executed and your personalization will take effect.
My understanding is this: you define the priority in BASHRC is higher than the content inside the profile, so if the two file profiles and BASHRC inside the same setting, the path is defined, then the system will first select the content of BASHRC.
So, for the java_home path problem I encountered, the solution I took was: directly BASHRC the definition inside .
Of course you can also leave the definition of bashrc inside, delete the definition of profile.
[Centos] Fix setup java_home continuous failure problem