Any idea why? It does set itself when I run one of the aliases, but that requires manually running the alias.Įdit 2: I found the problem: It was because I still had some code in my. Interestingly, if I type java -version, it does show my adoptopenjdk14 as the current version even though the variable JAVA_HOME doesn't exist. as soon as I start a new shell window and type echo $JAVA_HOME, nothing appears and upon inspection of variables listed by env, JAVA_HOME does not appear. Everything seems to work great now, thanks a ton!Įdit: I seem to be running into a problem where the command export JAVA_HOME= in my ~/.zshrc doesn't seem to actually set JAVA_HOME.
#Multiple jdk on mac how to
Here I will show how to manage multiple Java version on your UNIX based machine using SDKMAN. I'm sure it was a problem with my PATH, 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 own openjdk and uninstalled openjdk from my active conda base env. It allows us to install, remove, switch and list candidate versions of different SDKs including Java (e.g., JDK, Ant, Dotty, Gradle, Scala, and many more). Spark developers should use Java 8 for Spark 2 projects and Java 11 for Spark 3 projects for example. Running multiple Java versions is important for Android and Apache Spark developers. It also makes it easy to seamlessly switch between Java versions when you switch projects.
I had openjdk installed in my conda base env (it was required by another program installed with conda) and I could not get this solution to work until I uninstalled openjdk from my active conda env or switched to an env without openjdk installed. jenv makes it easy to run multiple versions of Java on a Mac computer. Quick warning: This does NOT seem to work if you have Java installed in some way through conda. Most other guides I tried to follow are written for outdated brew functionality. Thank you for this recent tutorial on how to manage Java versions with Homebrew.