Tutorials
Step‑by‑step guides to get up and running with javm.
1) Install javm
You can install from the latest release (default), nightly builds, or a specific version.
-
Linux/macOS (default to
~/.javm):- Latest:
curl -fsSL https://javm.dev/install.sh | bash - Nightly:
curl -fsSL https://javm.dev/install.sh | bash -s nightly - Specific:
curl -fsSL https://javm.dev/install.sh | bash -s v0.1.0
- Latest:
-
Windows (default to
%LOCALAPPDATA%\Programs\javm):- Latest:
irm https://javm.dev/install.ps1 | iex - Nightly:
iex "& { $(irm https://javm.dev/install.ps1) } nightly" - Specific:
iex "& { $(irm https://javm.dev/install.ps1) } v0.1.0"
- Latest:
2) Initialize your shell
Evaluate the output of javm init <shell> in your shell profile:
- Bash: add to
~/.bashrcor~/.zshrceval "$(javm init bash)"
- Zsh: add to
~/.zshrceval "$(javm init zsh)"
- Fish: add to
~/.config/fish/config.fishjavm init fish | source
- PowerShell: add to your profile (e.g.
$PROFILE)iex "$(javm init pwsh)"
3) First switch: install and use a JDK
- Search available versions (Temurin shown; use
--distribution=allto list all):javm ls-remote temurin@~21 --latest=minor
- Install a version:
javm install temurin@21
- Switch your shell to use it:
javm use temurin@21
- Confirm current version:
javm current
4) Optional: default JDK for new shells
- Set a default version used automatically in new shells:
javm default temurin@21
- After this,
javm init <shell>will append ajavm use <version>line into the init script so new shells pick it up.
5) Optional: per‑project JDK
- Create a
.java-versionfile in your project root (contents are a selector):- Example:
21
- Example:
- In that directory, run:
javm use(reads.java-versionand resolves best match)
6) Optional: link an existing system JDK
- Link a system JDK so javm can use it without managing install:
javm link system@1.8.72 /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk
- Use it:
javm use system@~1.8
- Remove a link:
javm unlink system@1.8.72