homebrew-openjdk
homebrew-openjdk copied to clipboard
Problem with switching between different JDK version on Mac Big Sur
Solution: Adding the command unset JAVA_HOME
to the jdk function like this answer suggest: https://stackoverflow.com/a/64917842/2315666
Please file a bug report on https://feedbackassistant.apple.com/. I don't have Big Sur, so I cannot reproduce the problem myself.
+1 to both the issue and @Fuddi's solution on 11.1
@aahlenst @karianna You guys think waiting on Apple is a valid solution here?
Urging Apple to fix by bombarding them with radars is a valid solution. I'm not looking forward to rollout an otherwise unnecessary fix to a large fleet of Macs and CI pipelines.
@gdams will make a doc change here
I'm still pretty bad at this whole java_home thing. I feel like it makes no sense. Sorry for being a noob. But I'm leaving this here in case anyone uses big sur and wants a simple copy paste for what to put in .zshrc (default on big sur)
# Change 14 to your installed version to be considered "default" on machine boot up
export JAVA_HOME=`/usr/libexec/java_home -v 14`
jdk() {
unset JAVA_HOME
version=$1
export JAVA_HOME=$(/usr/libexec/java_home -v"$version");
java -version
}
Let me know if I'm doing something wrong. I'm new to this.
This is working for Big Sur 11.2.3.
Greetings
jdk() {
unset JAVA_HOME
version=$1
export JAVA_HOME=$(/usr/libexec/java_home -v "$version");
export PATH=$JAVA_HOME/bin:$PATH
java -version
}