Java 8 appears to be installed but in fact is not (macOS) 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!
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