All right, so far I get that your attempt to change '$PATH' has not worked as expected (the "empty response" indicates that the variable is not set.
I've now done a test using exactly these commands:
cat << EOF | sudo tee /etc/profile.d/java.sh > /dev/null
export JAVA_HOME=/opt/java/jdk1.6.0_21
export PATH=\$PATH:\$JAVA_HOME/bin
( date ; echo \$JAVA_HOME ; echo \$PATH ) >> /tmp/java_path.log
EOF
grep -q 'etc/profile.d' /opt/.filetool.lst \
|| echo 'etc/profile.d' >> /opt/.filetool.lst
filetool.sh -bAnd the result is as expected: the $PATH has been changed to the desired new one after the next restart. Obviously the last line of the script (i.e. the one with the 'date' command) can be removed after it's working OK.
I got to admit that I had a bit of a laugh when reading:
Seems that getting exactly the right syntax is paramount.
In my experience in computing syntax is highly significant. It's not like cooking where it probably does not matter whether one uses 95g of sugar instead of 100g ...
EDIT: I only now saw the previous post about the success, I still leave this one standing for future reference. Or shall I call "educational" purpose?