Reference
Comprehensive reference for javm commands, flags, selectors, and configuration.
Global CLI
- Command:
javm - Global flags:
--version: print javm version and exit.--debug: enable verbose debug logging.--quiet: suppress non‑error logs.
Commands
install
- Usage:
javm install [selector] - Description: Download and install a JDK. If no selector is provided, reads
.java-versionfrom the current directory. - Selector forms:
- Distribution + version/range:
temurin@21,zulu@~1.8.144 - Custom URL:
<version>=<url>(e.g.1.8.0-custom=https://example.com/dist.tar.gz)
- Distribution + version/range:
- Flags:
-o, --output <path>: install to custom destination. Managed installs go to<cfg.Dir()>/jdk/<version>.
- Behavior:
- If the version is already installed, it is reused.
- On managed installs,
linktargets are refreshed to track the latest minor (viaLinkLatest).
uninstall
- Usage:
javm uninstall [selector] - Description: Uninstall a managed JDK that matches the selector.
- Notes:
system@...links cannot be uninstalled; usejavm unlink system@...instead.
link
- Usage:
javm link→ refresh latest minor symlinks.javm link [name]→ show link target forname.javm link [name] [path]→ create/update link.
- Description: Manage symlinks in
<cfg.Dir()>/jdkto point names likesystem@1.8.72or1.8to actual JDK directories. - Constraints:
- Names for system JDKs must begin with
system@and be valid semver selectors.
- Names for system JDKs must begin with
unlink
- Usage:
javm unlink [name] - Description: Remove a link from
<cfg.Dir()>/jdk.
use
- Usage:
javm use [selector] - Description: Modify current shell
PATHandJAVA_HOMEto use a specific JDK. - Behavior:
- Without arguments, reads
.java-versionfrom current directory. - Strips any previous javm/Jabba
jdkreferences fromPATHbefore setting the new one. - On macOS, uses
<path>/Contents/HomeforJAVA_HOME.
- Without arguments, reads
current
- Usage:
javm current - Description: Print the currently active javm version (if
javaresolves under<cfg.Dir()>/jdk).
ls
- Usage:
javm ls [range] [--latest=major|minor|patch] - Description: List installed versions, optionally filtered by range.
- Flags:
--latest: trim list to latest per major/minor/patch.
ls-remote
- Usage:
javm ls-remote [range] [flags] - Description: List remote versions available for install.
- Flags:
--os: target OS (macos,linux,windows), defaults to current.--arch: target arch (amd64,arm64), defaults to current.--distribution: Java distribution (e.g.temurin,zulu,corretto). Useallto list all.--latest: trim list to latest per major/minor/patch.
- Output: shows
Identifier(trimmed version),Full Version,DistributionandDistribution Version.
ls-distributions
- Usage:
javm ls-distributions - Description: List all available distributions from DiscoAPI.
- Output columns:
IdentifierandName.
which
- Usage:
javm which [selector] [--home] - Description: Print path to the installed JDK that matches selector; without selector, uses
.java-version. - Flags:
--home: append/Contents/Homeon macOS so result is suitable forJAVA_HOME.
init
- Usage:
javm init [shell] - Description: Print shell integration script for javm (bash, zsh, fish, nushell, pwsh/powershell).
- Behavior:
- Replaces
::JAVM::placeholder with path to the current executable. - If
default-versionexists in config dir, appendsjavm use <version>to init script. - On PowerShell, writes a temp script file and prints a command to execute it.
- Replaces
discover
- Parent:
javm discover - Subcommands:
refresh: force refresh of local discovery cache (TTL=0).list: list discovered JDKs. Use-d, --detailsfor full columns.
- Sources used: system, jabba, gradle, IntelliJ, javm.
default
- Usage:
javm default [selector] - Description: Set default Java version for new shells. Writes to
default-versionin config dir.
Selectors and ranges
- Qualifier + version/range:
temurin@21,zulu@~1.8.144,* @ >=1.6.45 <1.9(useallwithls-remoteinstead of*). - Range syntax (powered by Masterminds semver with compatibility tweaks):
1.8,1.8.x(implicit.xfor partial forms),~21.0.2,>=21 <22.- Pre‑0.7 compatibility adds
.xto single/double‑component ranges and inserts separators where needed.
- Trimming:
--latest=major|minor|patchreturns only the latest version per group.
Configuration
- Config directory (
cfg.Dir()):- Override with
JAVM_HOME. - Defaults:
- Windows:
%LOCALAPPDATA%\javm - macOS:
~/Library/Application Support/javm - Linux/Unix:
$XDG_DATA_HOME/javmor~/.local/share/javm
- Windows:
- Override with
- Managed installs live under
<cfg.Dir()>/jdk/<version>. - Aliases: stored as
<cfg.Dir()>/<name>.alias;link aliasmaintains<cfg.Dir()>/jdk/<name>symlink. .java-version: read from current working directory foruse,install,whichwhen selector is omitted.- Default version:
<cfg.Dir()>/default-version(used byjavm initto auto‑use on new shells). - Discovery cache:
<cfg.Dir()>/cache.jsonwith default TTL of 24h. - Discovery config:
<cfg.Dir()>/autodiscover/config.json(containsenabled, per‑source toggles, andcache_ttl).
Logging
--debug: verbose logs.--quiet: warning and errors only.