title: default value of JAVA_HOME seems to be overwriting the value set by: /etc/profile.d/java.sh
body: <p>I've created a file <code>/etc/profile.d/java.sh</code> that includes (among other things) the line of code: <code>export JAVA_HOME=/usr/java/jdk1.6.0_30</code>. However, when I log in via SSH or reboot the linux Centos 6.2 server, I always see:</p>
  
  <pre><code>[root@host3 /etc/profile.d]# echo $JAVA_HOME
  /usr/local/jdk
  </code></pre>
  
  <p>This is a new installation and server, so there's not much else done. It seems that the java.sh file is executing upon reboot or SSH login, however, the value of JAVA_HOME is being overwritten by the default value of <code>/usr/local/jdk</code> somehow. There isn't even a directory <code>jdk</code> under <code>/usr/local</code>. </p>
  
  <p>Any idea how to correct this? The value of JAVA_HOME needs to be set (as done in java.sh) for all users.</p>
  
  <p>UPDATE 1:</p>
  
  <p>I checked the /etc/profile file and searched for the text <code>jdk</code> as well as <code>JAVA</code> and neither were found. I also checked the /root/.bash_profile and it shows as follows:</p>
  
  <pre><code># .bash_profile
  
  # Get the aliases and functions
  if [ -f ~/.bashrc ]; then
      . ~/.bashrc
  fi
  
  # User specific environment and startup programs
  
  PATH=$PATH:$HOME/bin
  
  export PATH
  </code></pre>
  
  <p>Also, if I source java.sh, everything gets set correctly. But if I reboot server, JAVA_HOME goes back to <code>/usr/local/jdk</code>.</p>