Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java's path still /usr/bin/java after brew cask install java

I installed java with homebrew, using the command brew cask install java.

After successfully installing, I typed which java, and the path showed to be /usr/bin/java

When I typed brew cask info java, this showed up:

java: 1.8.0_102-b14 Java Standard Edition Development Kit

/usr/local/Caskroom/java/1.8.0_102-b14 (227.5M) https://github.com/caskroom/homebrew-cask/blob/master/Casks/java.rb Contents JDK 8 Update 102.pkg (pkg) Caveats This Cask makes minor modifications to the JRE to prevent issues with packaged applications, as discussed here: If your Java application still asks for JRE installation, you might need to reboot or logout/login.

Installing this Cask means you have AGREED to the Oracle Binary Code License Agreement for Java SE at

Did I forget to link something?

like image 474
Aaron Zorel Avatar asked Aug 12 '16 15:08

Aaron Zorel


2 Answers

/usr/bin/java is a symlink.

To see where it points, type ls -la /usr/bin/java

brew cask is installing into /Library/Java/JavaVirtualMachines/jdk1.8.0_something.jdk/Contents/Home

If the previous command ls -la is matching this, you are good.

If not, it means that you previously had another java installation. In this case, you may want to use a tool like jenv to switch between your multiple installs.

like image 74
Offirmo Avatar answered Oct 26 '22 03:10

Offirmo


To add to @djangofan .. when I did a brew reinstall, I noticed the following message:

==> Pouring openjdk--17.0.1_1.big_sur.bottle.tar.gz
==> Caveats
For the system Java wrappers to find this JDK, symlink it with

  sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

openjdk is keg-only, which means it was not symlinked into
/usr/local, because macOS provides similar software and
installing this software in parallel can cause all kinds of
trouble.

If you need to have openjdk first in your PATH, run:
 echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> /Users/johndoe/.bash_profile

For compilers to find openjdk you may need to set:
  export CPPFLAGS="-I/usr/local/opt/openjdk/include"

To his point, I did not install via cask. I assume that when you did the install you got a similar message that you simply did not notice.

like image 44
Mister Mister Avatar answered Oct 26 '22 02:10

Mister Mister