Get started with jm
jm installs and selects JDK builds without requiring a JVM to run the manager itself. This guide takes you from a fresh shell to a project with a reproducible Java requirement.
1. Install jm
brew install Shinnosuke0722/tap/jmscoop bucket add shinnosuke0722 https://github.com/Shinnosuke0722/scoop-bucket
scoop install shinnosuke0722/jmwinget install --id Shinnosuke0722.jm --exactcurl -fsSL https://raw.githubusercontent.com/Shinnosuke0722/jm/main/install.sh | shirm https://raw.githubusercontent.com/Shinnosuke0722/jm/main/install.ps1 | iexcargo install --git https://github.com/Shinnosuke0722/jm.git --lockedThe first WinGet manifest is still in microsoft/winget-pkgs#414637. Use that command only after winget search --id Shinnosuke0722.jm --exact returns the package.
The source build requires Rust 1.97.1 or newer. Prebuilt GitHub Release users do not need Rust or Cargo. Upgrade a source installation by re-running the Cargo command with --force.
Homebrew, Scoop, and WinGet manage command discovery for their installations. The following PATH commands are only for direct release-script or source builds:
export PATH="$HOME/.jm/bin:$PATH"$env:Path = "$HOME\.jm\bin;$env:Path"export PATH="${CARGO_INSTALL_ROOT:-${CARGO_HOME:-$HOME/.cargo}}/bin:$PATH"$cargoRoot = if ($env:CARGO_INSTALL_ROOT) {
$env:CARGO_INSTALL_ROOT
} elseif ($env:CARGO_HOME) {
$env:CARGO_HOME
} else {
"$HOME\.cargo"
}
$env:Path = "$cargoRoot\bin;$env:Path"These commands activate the default locations for the current session. Follow the prebuilt installer's printed instructions to persist its directory, or open a new terminal after the Windows installer updates the user PATH. If you chose a custom prebuilt directory or configured Cargo's --root, install.root, CARGO_INSTALL_ROOT, or CARGO_HOME, substitute the corresponding installation root. Verify the CLI is available before moving to step 2:
jm --versionIf a package manager owns the installation, also use it for upgrades: brew upgrade Shinnosuke0722/tap/jm, scoop update jm, or winget upgrade --id Shinnosuke0722.jm --exact. Do not run jm upgrade for a package-managed binary.
2. Install a JDK
Ask for a Java major version or include a distribution name:
jm install 21
jm install corretto-17The available result still depends on the upstream provider catalog for your operating system and architecture.
3. Set the global default
jm default 21
jm currentjm default selects an installed match and updates the manager's global JDK link.
4. Enable automatic switching
Run the command for your shell now, then add the same line to its startup file:
eval "$(jm shell init bash)"eval "$(jm shell init zsh)"jm shell init fish | sourcejm shell init powershell | Invoke-ExpressionThe command initializes the current shell, setting JAVA_HOME and putting the selected JDK's bin directory on PATH. Verify that the shell now uses the selected JDK:
java -versionThe hook selects only an already installed JDK. It does not silently download a missing project requirement.
5. Pin Java for a project
From the project directory, resolve an installed JDK and write its full ID:
jm use 21The command writes .java-version. Commit that file when the team should share the same Java requirement.
Continue
- Follow the complete project switching rules.
- Configure Windows and PowerShell.
- Manage Temurin, Corretto, and GraalVM side by side.
- Move an existing Java entry with the SDKMAN migration guide.