0

I have Java 8 and Java 9 installed on my system (not via Homebrew).

I have my JAVA_HOME env variable setup to point to Java 8 (in my .profile) and I can successful compile programs that require Java 8.

However I'm trying to install a program that also requires Java 8 via Homebrew, but it keeps failing - seemingly because it's trying to build it with Java 9.

Is there a way I can tell Homebrew to only build using Java 8?

Looking at the logs for the failed install strongly suggests Homebrew is trying to use Java 9 (its CFLAGS and PATH include references to "jdk-9", etc.). Where does Homebrew get its environment settings from?

Thanks in advance!

thoughton
  • 511
  • 1
  • 5
  • 10
  • 1
    Based on reading the answer at https://stackoverflow.com/questions/26252591/mac-os-x-and-multiple-java-versions/29195815#29195815, seems like you probably want to start by doing `brew install jenv` and then use `jenv init -`, `jenv add …`, and `jenv local …` to switch among versions. Details at https://hanxue-it.blogspot.com/2014/05/installing-java-8-managing-multiple.html and https://andrew-jones.com/blog/managing-multiple-versions-of-java-on-os-x/ and https://davidcai.github.io/blog/posts/install-multiple-jdk-on-mac/ – sideshowbarker Dec 14 '17 at 21:16
  • @sideshowbarker Thanks for that! It looked very promising for a while... but unfortunately I ended up with the exact same problem (Homebrew still trying to use Java 9 regardless). Still upvoting though, as 'jenv' does seem useful - it just didn't solve this particular problem sadly. – thoughton Dec 14 '17 at 22:36

0 Answers0