title: What is the good way of setting JAVA_HOME system wide in Linux? /etc/profile or /etc/profile.d/custom.sh?
body: <p>There doesn't seem to be an official answer as to where to set your system wide JAVA_HOME in Linux, at least I haven't found one (looked on Oracle website and some google fu). 
  Many forums and comments point at setting it in /etc/profile or even /etc/bashrc/ (or /etc/bashrc.bashrc) but on my system both these files headers are quite specific about creating </p>
  
  <blockquote>
    <p>"a custom.sh shell script in /etc/profile.d/ [...] as this will
    prevent the need for merging in future updates." </p>
  </blockquote>
  
  <p>instead of directly modifying the files.</p>
  
  <p>For this reason I'm thinking the custom.sh shell script placed in /etc/profile.d is the way to go but I might be missing something hence this question =)</p>
  
  <p>Please forgive me if I missed an official doc and just post the link!</p>
  
  <hr>