Home jenv
Post
Cancel

jenv

Install

1
brew install jenv

References

git repo

Usage

  • doctor

    1
    
    jenv doctor
    
  • init jenv

    1
    
    echo 'eval "$(jenv init -)"' > ~/.zprofile
    
  • jenv add

    1
    2
    3
    4
    
    # add sdkman installed java
    jenv add .sdkman/candidates/java/8.0.352-librca/
    # add brew installed java
    jenv add /opt/homebrew/Cellar/openjdk@11/11.0.16.1_1
    
  • display versions

    1
    
    jenv versions
    
  • display version

    1
    
    jenv version
    
  • jenv local

    1
    2
    3
    4
    
    jenv local 11.0.2
    exec $SHELL -l
    cat .java-version
    echo ${JAVA_HOME}
    
  • jenv global

    1
    2
    
    # set a global Java version
    jenv global 11.0.2
    
  • jenv shell

    1
    2
    
    #set the Java used in this particular shell session
    jenv shell 11.0.2
    

To make sure JAVA_HOME is set, make sure to enable the export plugin:

1
2
jenv enable-plugin export
exec $SHELL -l
This post is licensed under CC BY 4.0 by the author.