Problems with java >= 1.8 requirement


(Stephen Duncan Jr) #1

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: /Library/Java/JavaVirtualMachines/jdk1.8.0_192.jdk/Contents/Home

I also have a Java 11 JDK provided by the adoptopenjdk cask. If I change my JAVA_HOME to /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home that is also not recognized as meeting the >= 1.8 requirement.


(Stephen Duncan Jr) #2

Using brew irb and running JavaRequirement.new(%w[1.8+]).send("possible_javas") gives:

=> [#Pathname:/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java]

Which then doesn’t work with the version parsing. So that makes sense. And since my JAVA_HOME is set locally in my shell, maybe it doesn’t pick it up in the context that brew runs. Should brew pick up my JAVA_HOME from when I run it, or does it load the environment from somewhere else? Other than uninstalling adoptopenjdk version 11, how can I make homebrew aware of the java8 version I have installed?


Edit: Wrapped your command line in “`”s to keep Discourse from modifying quotation marks.@claui