If you have a oracle JDK or JRE installed shit will hit the fan. I've had the same issue.
You can check if oracle is hijacking your system with:
$/usr/libexec/java_home -V
Matching Java Virtual Machines (4):
		15.0.1 (x86_64) "UNDEFINED" - "OpenJDK 15.0.1" /usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home
		1.8.191.12 (x86_64) "Oracle Corporation" - "Java" /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
		1.8.0_275 (x86_64) "Amazon" - "Amazon Corretto 8" /Users/hellothere/Library/Java/JavaVirtualMachines/corretto-1.8.0_275/Contents/Home
		1.8.0_272 (x86_64) "Amazon" - "Amazon Corretto 8" /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home
You can fix this by a self-uninstall tool called "rm -rf". After that "/usr/libexec/java_home" will behave as you expect it to.
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane
Just for your ease, I use the following script in my .zprofile to easily switch JDK:
Simple function allowing you to easyly switch version of java
function setjdk() {
	if [ $-ne 0 ]; then
	 removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'
	 if [ -n "${JAVA_HOME+x}" ]; then
		removeFromPath $JAVA_HOME
	 fi
	 unset JAVA_HOME
	 export JAVA_HOME=`/usr/libexec/java_home -v $@`
	 export PATH=$JAVA_HOME/bin:$PATH
	fi
}
function removeFromPath() {
	export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")
}
setjdk 1.8 set initial version