Skip to main content

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
  • 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"

2) Initialize your shell

Evaluate the output of javm init <shell> in your shell profile:

  • Bash: add to ~/.bashrc or ~/.zshrc
    • eval "$(javm init bash)"
  • Zsh: add to ~/.zshrc
    • eval "$(javm init zsh)"
  • Fish: add to ~/.config/fish/config.fish
    • javm 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=all to 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 a javm use <version> line into the init script so new shells pick it up.

5) Optional: per‑project JDK

  • Create a .java-version file in your project root (contents are a selector):
    • Example: 21
  • In that directory, run:
    • javm use (reads .java-version and resolves best match)
  • 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