{"id":13400499,"url":"https://github.com/jenv/jenv","last_synced_at":"2025-12-17T20:57:59.126Z","repository":{"id":6566988,"uuid":"7808903","full_name":"jenv/jenv","owner":"jenv","description":"Manage your Java environment ","archived":false,"fork":false,"pushed_at":"2025-12-05T02:23:08.000Z","size":551,"stargazers_count":6469,"open_issues_count":87,"forks_count":393,"subscribers_count":65,"default_branch":"master","last_synced_at":"2025-12-08T10:10:25.751Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.jenv.be","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jenv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2013-01-24T22:43:30.000Z","updated_at":"2025-12-08T04:12:31.000Z","dependencies_parsed_at":"2024-01-03T01:27:58.232Z","dependency_job_id":"b476da4d-3737-4382-bfc7-75287d565478","html_url":"https://github.com/jenv/jenv","commit_stats":{"total_commits":192,"total_committers":74,"mean_commits":"2.5945945945945947","dds":0.7864583333333334,"last_synced_commit":"2329e5cb72cc9f25beb8fda4741a2689fd8b8e29"},"previous_names":["gcuisinier/jenv"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/jenv/jenv","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenv%2Fjenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenv%2Fjenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenv%2Fjenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenv%2Fjenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jenv","download_url":"https://codeload.github.com/jenv/jenv/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jenv%2Fjenv/sbom","scorecard":{"id":515178,"data":{"date":"2025-08-11","repo":{"name":"github.com/jenv/jenv","commit":"82fc72f3aae76c73635d6f333fdb0b4b1f2fbd24"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.6,"checks":[{"name":"Code-Review","score":2,"reason":"Found 5/17 approved changesets -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":10,"reason":"19 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/jenv/jenv/release.yml/master?enable=pin","Warn: containerImage not pinned by hash: test/Dockerfile:1: pin your Docker image by updating redhat/ubi8 to redhat/ubi8@sha256:4f0a4e4deb450583408a06165e92a4dcd4f0740a23815f3326fc5c97ee9ca768","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 23 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-20T01:37:22.983Z","repository_id":6566988,"created_at":"2025-08-20T01:37:22.983Z","updated_at":"2025-08-20T01:37:22.983Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27781450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-17T02:00:08.291Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T19:00:52.678Z","updated_at":"2025-12-17T20:57:59.120Z","avatar_url":"https://github.com/jenv.png","language":"Shell","readme":"# Master your Java Environment with jenv\n\nWebsite : https://www.jenv.be\n\nMaintainers : \n- [Gildas Cuisinier](https://github.com/gcuisinier/)\n\nFuture maintainer in discussion:\n- [Benjamin Berman](https://github.com/doctorpangloss) \n\nAs he makes an incredible work by taking time to merge the Pull Request on his fork, I (@gcuisinier) am in discussion with him to take part of jEnv directly if he wants.\nWhatever his decision, I thank him for his work, and to have convincing me to think about the future of jEnv and accepting a new maintainer for the good of the project.\n\n## What's jEnv ?\n\nThis is an updated fork of `jenv`, a beloved Java environment manager adapted from `rbenv`.\n\n`jenv` gives you a few critical affordances for using `java` on development machines:\n\n - It lets you switch between `java` versions. This is useful when developing Android applications, which generally require Java 8 for its tools, versus server applications, which use later versions like Java 11.\n - It sets `JAVA_HOME` inside your shell, in a way that can be set globally, local to the current working directory or per shell.\n\nHowever, this project does **not**:\n\n - Install `java` for you. Use your platform appropriate package manager to install `java`. On macOS, `brew` is recommended.\n\nThis document will show you how to install `jenv`, review its most common commands, show example workflows and identify known issues.\n\n### Contents\n\n 1. [Getting Started](#1-getting-started)\n 2. [Example Workflows](#2-common-workflows)\n 3. [Known Issues](#3-known-issues)\n\n### 1. Getting Started\n\nFollow the steps below to get a working `jenv` installation with knowledge of your `java` environment. Read all the code you execute carefully: a `$` symbol at the beginning of a line should be omitted, since it's meant to show you entering a command into your terminal and observing the response after the command.\n\n#### 1.1 Installing `jenv`\n\nOn macOS, you can install jEnv using [Homebrew](https://brew.sh):\n\n```bash\nbrew install jenv\n```\n\nOr if you use [MacPorts](https://www.macports.org) on macOS:\n\n```bash\nsudo port install jenv\n```\n\nAlternatively, and on Linux, you can install it from source:\n\n```bash\ngit clone https://github.com/jenv/jenv.git ~/.jenv\n# Shell: bash\necho 'export PATH=\"$HOME/.jenv/bin:$PATH\"' \u003e\u003e ~/.bash_profile\n# Shell: zsh\necho 'export PATH=\"$HOME/.jenv/bin:$PATH\"' \u003e\u003e ~/.zshrc\n# Shell: fish\necho 'set PATH $HOME/.jenv/bin $PATH' \u003e\u003e ~/.config/fish/config.fish\n```\n\n#### 1.2 Configuring your shell\n\njEnv needs to be intialised in your shell by evalling the output of `jenv init -`. e.g.\n\n```bash\n# Shell: bash\necho 'eval \"$(jenv init -)\"' \u003e\u003e ~/.bash_profile\n# Shell: zsh\necho 'eval \"$(jenv init -)\"' \u003e\u003e ~/.zshrc\n```\n\nRestart your shell by closing and reopening your terminal window or running `exec $SHELL -l` in the current session for `jenv` to take effect.\n\n##### Support for fish\n\n**Untested**: While this fork has improved `fish` shell support, it has not been tested by this maintainer. To install `jenv` for Fish according to the contributor's instructions:\n\n```sh\necho 'status --is-interactive; and jenv init - | source' \u003e\u003e ~/.config/fish/config.fish\ncp ~/.jenv/fish/jenv.fish ~/.config/fish/functions/jenv.fish\n```\n\n#### 1.3 Enable the export plugin\n\nTo have `JAVA_HOME` get set by jEnv, enable the `export` plugin. This needs to be done in an initialised shell:\n\n```bash\neval \"$(jenv init -)\" # if not already restarted your shell\njenv enable-plugin export\n```\n\nRestart your shell by closing and reopening your terminal window or running `exec $SHELL -l` in the current session for the changes to take effect.\n\n#### 1.4 Verifying your installation\n\nTo verify `jenv` was installed and initialised, run `jenv doctor`. On a macOS machine, you'll observe the following output:\n\n```bash\n$ jenv doctor\n[OK]\tNo JAVA_HOME set\n[ERROR]\tJava binary in path is not in the jenv shims.\n[ERROR]\tPlease check your path, or try using `jenv add /path/to/java/home`\n\tPATH : /Users/user/.jenv/libexec:/Users/user/.jenv/shims:/Users/user/.jenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin\n[OK]\tJenv is correctly loaded\n```\n\nObserve that `jenv` is correctly loaded but Java has not yet been added to `jenv`.\n\n#### 1.5 Adding Your Java Environment\n\nUse `jenv add` to inform `jenv` where your Java environment is located. `jenv` does not, by itself, install Java.\n\nFor example, on macOS, use `brew` to install the latest Java (OpenJDK 21, also follow the caveat steps to symlink into the system virtual machines) followed by the appropriate `jenv add PATH_TO_JVM_HOME` command to recognize it.\n\n```bash\nbrew install java\nsudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk\njenv add \"$(/usr/libexec/java_home)\" # this will always default to the latest version in /Library/Java/JavaVirtualMachines\n# or\n# jenv add /Library/Java/JavaVirtualMachines/openjdk.jdk\n# or for fish shell (see: https://fishshell.com/docs/current/tutorial.html#command-substitutions)\n# jenv add (/usr/libexec/java_home)\n```\n\nWith macOS OpenJDK 21.0.2 installed, for example, either of these commands will add `/Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Home` as a valid JVM. Your JVM directory may vary!\n\nObserve now that this version of Java is added to your `jenv versions` command:\n\n```bash\n$ jenv versions\n* system (set by /Users/user/.jenv/version)\n  21\n  21.0\n  21.0.2\n  openjdk64-21.0.2\n```\n\n`jenv` adds multiple variants of each Java version assuming they have not already been added.\nThis allows you to add multiple JDKs of the same major version and have a way to differentiate them.\n\nBy default, the latest version of Java is your `system` Java on macOS.\n\nWe'll now set a `jenv local VERSION` local Java version for the current working directory. This will create a `.java-version` file we can check into Git for our projects, and `jenv` will load it correctly **when a shell is started from this directory**.\n\n```bash\n$ jenv local 21.0.2\n$ cat .java-version\n21.0.2\n```\n\nIs `JAVA_HOME` set?\n\n```bash\n$ echo ${JAVA_HOME}\n/Users/bberman/.jenv/versions/21.0.2\n```\n\nYes! Observe that `JAVA_HOME` is set to a valid shim directory - this is a result of enabling the `export` plugin.\n\nIf you executed this commands inside your `$HOME` directory, you can now delete `.java-version`:\n\n```bash\njenv local --unset\n# or\nrm .java-version\n```\n\n#### 1.6 Setting Java versions\n\n`jenv` can set Java versions at 3 levels:\n- global (lowest priority)\n- local\n- shell (highest priority)\n\nWhere multiple versions are set, the highest priority setting as above takes effect.\n\nFor example if the global version was 17 and the shell version was 11, 11 would be used.\n\n##### 1.6.1 Setting a Global Java Version\n\nUse `jenv global VERSION` to set a global, default Java version:\n\n```bash\njenv global 21.0.2\n```\n\nWhen you next open a shell or terminal window, this version of Java will be the default.\n\nIt can be unset with\n```bash\njenv global --unset\n```\n\nOn macOS, `JAVA_HOME` for GUI applications can be set using:\n\n```bash\njenv macos-javahome\n```\n\nIntegrates [this tutorial](https://web.archive.org/web/20211129032418/https://www.ibm.com/docs/en/maximo-anywhere/7.6.2?topic=tp-you-receive-error-that-java-home-variable-is-not-set-even-if-you-have-set-java-home) to create a file that does **not update dynamically** depending on what local or shell version of Java is set, only global.\n\n##### 1.6.2 Setting a local Java Version\n\nUse `jenv local VERSION` to set the Java used in this folder.\n\nThis version will activate whenever you `cd` into the follder. This is useful in the root of projects, for example where you would typically run a\n`./gradlew build` or `./mvnw package` command from.\n\n```bash\njenv local 21.0.2\n```\n\nThis can be unset with\n```bash\njenv local --unset\n# or\nunset .java-version\n```\n\n##### 1.6.3 Setting a Shell Java Version\n\nUse `jenv shell VERSION` to set the Java used in this particular shell session:\n\n```bash\njenv shell 21.0.2\n```\n\nThis can be unset with\n```bash\njenv shell --unset\n# or\nunset JENV_VERSION\n```\n\n### 2 Common Workflows\n\nThese common workflows demonstrate how to use `jenv` to solve common problems.\n\n#### 2.1 Using Two JVMs on macOS\n\nOur goal is to have both the latest version of Java and JDK 8 installed at the same time. This is helpful for developing Android applications, whose build tools are sensitive to using an exact Java version.\n\nWe'll resume where we left off with Java 21.0.2 installed. Let's install Java 8 from brew and symlink it into the Library folder per the caveats.\n\n```bash\nbrew install openjdk@8\nsudo ln -sfn /usr/local/opt/openjdk@8/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-8.jdk\n```\n\nThis will install the latest version of Java 8 to a special directory in macOS. Let's see which directory that is:\n\n```bash\n$ ls -1 /Library/Java/JavaVirtualMachines \nopenjdk-8.jdk\nopenjdk.jdk\n```\n\nObserve the `openjdk-8.jdk` directory. **Your exact version may vary**. We cannot retrieve this using `/usr/libexec/java_home`, unfortunately. We'll add the Java home directory using `jenv` so that it shows up in our `jenv versions` command:\n\n```bash\n$ jenv add /Library/Java/JavaVirtualMachines/openjdk-8.jdk/Contents/Home/\nopenjdk64-1.8.0.222 added\n1.8.0.222 added\n1.8 added\n$ jenv versions\n* system\n  1.8\n  1.8.0.222\n  openjdk64-1.8.0.222\n  21\n  21.0\n  21.0.2\n  openjdk64-21.0.2\n```\n\n#### 2.2 Other Workflows\n\nPlease contribute your own using a pull request!\n\n### 3 Known Issues\n\nUsers seem to have issues using `jenv` with Fish. Please report any here.\n\nProblem? Please visit the [Trouble Shooting](https://github.com/jenv/jenv/wiki/Trouble-Shooting) Wiki page.\n\n","funding_links":[],"categories":["Shell","Projects","项目","Java环境管理","Version-Switch-Tools","Version Managers"],"sub_categories":["Version Managers","版本管理器","Java"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenv%2Fjenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjenv%2Fjenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjenv%2Fjenv/lists"}