I'm using zsh
as my shell, and I'm trying to configure my environment.
I usually define my $JAVA_HOME
variable by creating a file:
/etc/profile.d/java.sh
with the following content
export JAVA_HOME=/path/to/jdk
export PATH=$JAVA_HOME/bin:$PATH
then I logout and back in, and it all works, but for some reason the PATH
variable is not set. It recognizes JAVA_HOME
, but not the new PATH
, see this terminal snippet:
~ echo $JAVA_HOME
/usr/lib/jvm/jdk1.8.0_05
~ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
and I confirmed it by trying to run a command form the jvm
~ java -version
zsh: command not found: java
the PATH
doesn't include the $JAVA_HOME
as it should. is there something else I should check?
I have checked that if I run:
source /etc/profile.d/java.sh
it all runs correctly and my variables get set as they should, but shouldn't the scripts in /etc/profile.d
run automatically?