After update brew to latest version, when calling
cask related command, it always outputs
Error: Cask 'java' is unavailable: No Cask with this name exists., such as
brew list --cask. However,
brew command works.
After doing some research, I found Java has been moved to homebrew/core. As I installed java by cask, now it’s not available and throw this error. Now I need to uninstall it from cask.
Finally I found this issue: brew cask upgrade fails with “No Cask with this name exists”. After running
rm -rf "$(brew --prefix)/Caskroom/java, the error disappears.