Reputation: 806
Installing java 8 and sbt with brew and/or brew cask is clearly possible, The problem I am hitting is that brew installs java 13 as sbt dependency,
And I do not know a general way to go back to java 8 as default, since there are so many ways potentially to opt between java version some of which i am aware include PATH, JAVA_HOME, ln -s, java_exec selector.
Another problem potentially is that brew install sbt installs brew install java which is 13, But java 8 I install it via brew cask.
The TL is saying that Java 13 or 14 might be causing some issues e.g. tests fails, should I push for latest versions of OpenJdk, Scala, SBT, etc?
Upvotes: 2
Views: 3915
Reputation: 806
Indeed, SDK Man is an option. It actually works with brew also but there need to be just a few manual steps: here they are:
Installing sbt, java8, jenv & configure the shell
We used brew to install sbt (which in its turn installs java 13), and brew cask to install openjdk java 8, like this:
brew install sbt
brew tap AdoptOpenJDK/openjdk
brew cask install adoptjava8
We will use jenv to manage the java versions, with the information from https://github.com/Homebrew/homebrew-core/issues/31390
Basically the next steps are:
brew install jenv
jenv init -
echo 'eval "$(jenv init -)"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.zprofile
jenv add <path-to-java8-Home-Dir>
Then restart your terminal and you should now be able to run sbt
Where at time of writing <path-to-java8-Home-Dir>
is /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
Upvotes: 5