1. Delete the running path and running environment
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
Enter the password, press Enter, continue
sudo rm -fr /Library/PreferencesPanes/JavaControlPanel.prefPane
sudo rm -fr ~/Library/Application\ Support/Java
2. View the current jdk version
java -version
3. View the jdk path
/usr/libexec/java_home -V
4. Delete the current version of jdk, pay attention to check whether the version number is the version you want to delete
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk
5. Check whether jdk has been uninstalled
java -version