Here is a quick tip on how to install multiple Java JDK versions (8, …, 11, …, 14 etc.) on macOS X and how to switch between them for your applicat...
For further actions, you may consider blocking this person and/or reporting abuse
Thank you for this recent tutorial on how to manage Java versions with Homebrew. Most other guides I tried to follow are written for outdated
brew
functionality.Quick warning: This does NOT seem to work if you have Java installed in some way through
conda
. I hadopenjdk
installed in myconda
base
env (it was required by another program installed with conda) and I could not get this solution to work until I uninstalledopenjdk
from my activeconda
env or switched to an env withoutopenjdk
installed. I'm sure it was a problem with myPATH
, but since I couldn't figure it out after a while, I just made a new conda env with the tools that automatically install their ownopenjdk
and uninstalledopenjdk
from my activeconda
base env. Everything seems to work great now, thanks a ton!Edit: I seem to be running into a problem where the command
export JAVA_HOME=[...]
in my~/.zshrc
doesn't seem to actually setJAVA_HOME
. E.g. as soon as I start a new shell window and typeecho $JAVA_HOME
, nothing appears and upon inspection of variables listed byenv
,JAVA_HOME
does not appear. Interestingly, if I typejava -version
, it does show myadoptopenjdk14
as the current version even though the variableJAVA_HOME
doesn't exist. Any idea why? It does set itself when I run one of the aliases, but that requires manually running the alias.Edit 2: I found the problem: It was because I still had some code in my
.zshrc
from trying a previous solution.Hey Marc, you should check out SDKMAN!, you can easily switch between (but also install and uninstall) different Java (and Scala, and Gradle, and Kotlin, Groovy, sbt, Spring Boot, ...) versions using SDKMAN! It's seriously amazing, and really easy to use.
Hi Andrew, thanks for the tip! I'll it try out!