Most of us have used nvm for managing multiple versions of nodes. In java based developments, we also find the necessity of same kind of tools. Here comes 'jenv' to facilitates that.
How to install
on Mac,
brew install jenvcheck whether installation is successful
jenv --versionThen install multiple version of jdk , e.g. JDK8, JDK11 or JDK17 etc.( if not already installed)
add the jdk installed path to jenv
jenv add {path-to-jdk-folder-to jdk-8}/Contents/Homejenv add /opt/homebrew/opt/openjdk@17To list down available jdk versions to switch between
jenv versionsTo set a jdk version in the env
jenv global 17 or jenv global 8or locally within that project
jenv local 17 or jenv local 8Also, if there are issues.
check
- jdk path / installations
- ~/.zshrc file, whether .jenv is in the path
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"- Also, rehash using
jenv rehash