Search code examples
javamacoshomebrewhomebrew-cask

installing Java via brew and cask


I just installed Java via brew cask on my mac.

brew cask install java8

It installed into /Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home.

I then set java home in my .zshrc file.

export JAVA_HOME=$(/usr/libexec/java_home)

But when I type which java it shows.

/usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java

Does this correspond to the Java I just installed?


Solution

  • The shell command search and the which command use the PATH environment variable, not JAVA_HOME. Unless there is something in your .zshrc that is setting the PATH based on JAVA_HOME then setting JAVA_HOME isn't going to have any impact on which.