For formula such as sbt or scala, there is a requirement of java >= 1.8. The test for this requirement seems to be broken for the latest version of java 8, as well as not being good enough to identify alternate JDK providers which are likely to be more common.
I have Java 8 installed using the java8 cask from homebrew-cask-versions. My
JAVA_HOME is set to that location:
I also have a Java 11 JDK provided by the adoptopenjdk cask. If I change my
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home that is also not recognized as meeting the >= 1.8 requirement.