ScriptsJul 13, 2026·3 min read

jEnv — Manage Multiple Java Versions on macOS and Linux

jEnv is a shell tool for managing parallel JDK installations on macOS and Linux, letting developers switch Java versions per project or globally with a single command.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
jEnv Overview
Direct install command
npx -y tokrepo@latest install 6c5f4276-7eb9-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

jEnv is a command-line tool that manages multiple Java Development Kit (JDK) installations on a single machine. Inspired by rbenv for Ruby and pyenv for Python, it lets developers switch between JDK versions globally, per shell session, or per project directory. jEnv does not install JDKs itself; it manages paths to JDKs you have already installed.

What jEnv Does

  • Registers multiple installed JDK versions and assigns short aliases (e.g., 17, 21)
  • Sets the active JDK globally, per shell, or per directory via a .java-version file
  • Shims java, javac, and other JDK binaries to route to the selected version
  • Supports plugins for Maven, Gradle, and JAVA_HOME export integration
  • Lists all registered JDK versions and shows which is currently active

Architecture Overview

jEnv works by placing a shims directory on your PATH that intercepts java and javac calls. When invoked, the shim checks for a .java-version file in the current directory hierarchy, then the shell-local setting, then the global default. It resolves the target JDK home directory and delegates to the real binary. The plugin system allows hooks like automatically setting JAVA_HOME or configuring build tool wrappers.

Self-Hosting & Configuration

  • Install via Homebrew (macOS) or clone the git repository to ~/.jenv
  • Add eval "$(jenv init -)" to your shell profile (.bashrc or .zshrc)
  • Install JDKs via your preferred method (Homebrew, SDKMAN, Adoptium, manual download)
  • Register each JDK with jenv add /path/to/jdk
  • Enable the export plugin (jenv enable-plugin export) to auto-set JAVA_HOME

Key Features

  • Per-project Java version pinning via .java-version files committed to git
  • Shell-level version overrides for temporary testing without changing project config
  • Plugin ecosystem for Maven, Gradle, and JAVA_HOME integration
  • Compatible with any JDK distribution: Temurin, Corretto, GraalVM, Zulu, Oracle
  • Lightweight shell-only implementation with no daemon process

Comparison with Similar Tools

  • SDKMAN — installs and manages JDKs and other JVM tools; jEnv only manages already-installed JDKs
  • asdf + java plugin — multi-language version manager; jEnv is Java-specific and simpler
  • mise — modern polyglot version manager; jEnv is focused solely on JDK switching
  • update-alternatives (Linux) — system-level alternative management; jEnv is user-level and per-project
  • jabba — cross-platform JDK installer and switcher; jEnv has a larger community

FAQ

Q: Does jEnv install JDKs for me? A: No. jEnv only manages versions. Install JDKs via Homebrew, SDKMAN, Adoptium, or manual download, then register them with jenv add.

Q: How do I make Maven use the jEnv-selected JDK? A: Enable the Maven plugin: jenv enable-plugin maven. This sets JAVA_HOME before Maven runs.

Q: Can I use jEnv on Linux? A: Yes. Clone the jenv repository to ~/.jenv and add the init script to your shell profile.

Q: Does jEnv support Windows? A: jEnv is designed for Unix shells (bash, zsh, fish). On Windows, consider using SDKMAN via WSL or jabba.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets