Can be used in both Bash and ZSH. Just add it to your .bashrc
/.zshrc
and you're all set.
Load macos-jdk as a plugin in your .zshrc
zplug "deluan/macos-jdk"
Include the load command in your .zshrc
zgen load deluan/macos-jdk
zgen save
Bundle macos-zsh in your .zshrc
antigen bundle deluan/macos-jdk
antigen apply
As an Oh My ZSH! custom plugin
Clone macos-jdk into your custom plugins repo
git clone https://github.com/deluan/macos-jdk $ZSH_CUSTOM/plugins/macos-jdk
Then load as a plugin in your .zshrc
plugins+=(macos-jdk)
Show all installed versions
$ jdk
Select a specific version (only valid for current session)
$ jdk 8
To set the default jdk to be used in your system, create a ~/.jdkversion
file with the version number in it