-1

I want to understand why java_home is not setup for my system as a whole but only bash_profile

echo $JAVA_HOME // it return empty value

It return proper path inside bash profile

source ~/.bash_profile
echo $JAVA_HOME 
/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home
Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95
Yash
  • 121
  • 7
  • This has nothing to do with java and all to do with bash. Please next time tag accordingly. – Federico klez Culloca Sep 01 '23 at 09:46
  • 2
    By the way, for the last 3-4 years bash is no longer the default shell for macos. It's now zsh. So 1) are you sure you're running bash? 2) check whether your `~/.zshrc` loads `.bash_profile`. If it doesn't see [here](https://stackoverflow.com/questions/18819124/how-to-run-bash-profile-in-mac-terminal). – Federico klez Culloca Sep 01 '23 at 10:45
  • @FedericoklezCulloca Thanks, i am using ZSH terminal by default. Your suggested link answered all my doubts – Yash Sep 01 '23 at 10:57
  • First you don't show how you set `JAVA_HOME`. We can't see whether you set it as environment variable or as a shell variable. Then you don't tell us how you ensure that `.bash_profile` has been sourced in the bash instance where you test the value unsuccessfully (.bash_profile is only source by a bash **login** shell). – user1934428 Sep 01 '23 at 12:43

0 Answers0