1

I downloaded Java 8 from oracle.com, and I installed it. Nothing unusual. But when I type java I get: No Java runtime present, requesting install. And if I go to settings the java icon is there!

7
  • your installation directory should be in PATH. what is the output of echo $PATH
    – anki
    Feb 22, 2020 at 13:14
  • /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Library/Apple/bin:/Applications/VMware Fusion.app/Contents/Public:/Library/Frameworks/Mono.framework/Versions/Current/Commands Feb 22, 2020 at 13:15
  • /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java Feb 22, 2020 at 13:17
  • the path to the java Feb 22, 2020 at 13:17
  • @MANGUSTANobody try adding /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin instead of /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java to your path Feb 22, 2020 at 13:39

1 Answer 1

0

I recommend using jenv and Homebrew together to manage Java installations and environments, especially as you're working from the command line.

Install jenv

brew install jenv

Then install the java version you want, Java 8 is annoying bc it's not in Homebrew itself anymore, but this works

brew cask install adoptopenjdk/openjdk/adoptopenjdk8

Then add it to jenv

jenv add /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

Then set it as the global java

jenv global 1.8

Now java -version is

openjdk version "1.8.0_242"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_242-b08)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.242-b08, mixed mode)

jenv has been very useful to me as a Java developer for managing and switching between all my different Java versions. It also conveniently lets you set versions specific to projects/directories with jenv local

2
  • /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home is not a valid path to java installation Feb 22, 2020 at 13:43
  • at the second step : Failure while executing; git clone https://github.com/adoptopenjdk/homebrew-openjdk /usr/local/Homebrew/Library/Taps/adoptopenjdk/homebrew-openjdk --depth=1 exited with 128. Feb 22, 2020 at 13:45

Not the answer you're looking for? Browse other questions tagged .