I am having trouble changing the version of java running on my Mac running Big Sur 11.2 with zsh. I want to set Java 1.8 as my default, so I used the following commands to set JAVA_HOME:
$ unset JAVA_HOME
$ export JAVA_HOME=$(/usr/libexec/java_home -v "1.8.0_281")
$ echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.8.0_281.jdk/Contents/Home
However, when I ran java -version I kept getting JDK 15 as the current default. I then removed jdk15 from the JavaVirtualMachines directory and repeated the setting of JAVA_HOME, but I continue to observe the same result.