you know , edit the file under root or home is only for specific user, not for global. I agree with upstair.
It is easy to moderate /etc/profile. I check latest article that if you edit /etc/profile.d/java.sh (if no, simply create it), it's easier to maintain. Just for this reason