Skip to content

maskedsyntax/jvman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jvman

Cross-platform Java Version Manager. Install and switch between multiple JDK versions on Linux, macOS, and Windows.

Website: jvman.maskedsyntax.com

Installation

Setup has three steps: install the jvman CLI, run init, then add Java shims to your PATH. These are two different directories — do not skip step 1.

1. Install the jvman CLI

Pick one method, then verify the command works:

jvman version

Download binary (recommended)

Download the latest release for your platform from GitHub Releases.

Linux/macOS:

# Download and extract (replace VERSION and PLATFORM)
curl -LO https://github.com/maskedsyntax/jvman/releases/download/VERSION/jvman_VERSION_PLATFORM.tar.gz
tar -xzf jvman_VERSION_PLATFORM.tar.gz
sudo mv jvman /usr/local/bin/
jvman version

Windows: Download the .zip file and add jvman.exe to your PATH.

Using Go

go install github.com/maskedsyntax/jvman/cmd/jvman@latest
export PATH="$HOME/go/bin:$PATH"
jvman version

go install puts the binary in $HOME/go/bin, not $HOME/.jvman/bin. Add $HOME/go/bin to your PATH before running any jvman commands.

Build from source

git clone https://github.com/maskedsyntax/jvman.git
cd jvman
go build -o jvman ./cmd/jvman
./jvman version

You can use ./jvman directly, or move the binary to a directory on your PATH (e.g. /usr/local/bin).

2. Initialize

jvman init

This creates config and Java tool shims (java, javac, etc.) in $HOME/.jvman/bin.

3. Add Java shims to PATH

Add the shim directory so java, javac, and other JDK tools resolve through jvman:

export PATH="$HOME/.jvman/bin:$PATH"

Add to your shell profile (~/.bashrc, ~/.zshrc, etc.) to make it permanent. If you installed via Go, your profile needs both directories:

export PATH="$HOME/go/bin:$PATH"       # jvman CLI
export PATH="$HOME/.jvman/bin:$PATH"   # java, javac, jar, …

Usage

Install a JDK

jvman install 21                      # Install Temurin 21 (default vendor)
jvman install 17 --vendor=corretto    # Install Amazon Corretto 17
jvman install 11 -v zulu              # Install Azul Zulu 11
jvman install 21 --arch=aarch64       # Install for specific architecture

Supported vendors: temurin (default), corretto, zulu

Supported architectures: x64, aarch64

List versions

jvman list                   # Show installed and available versions from all vendors
jvman list --vendor=temurin  # Filter to a specific vendor
jvman list --refresh         # Bypass cache and fetch fresh data

Version lists are cached for 1 hour. Use --refresh or jvman cache clear to get fresh data.

Switch versions

Set the global default:

jvman global 21           # Use version 21 (auto-detects vendor)
jvman global temurin-21   # Use specific vendor-version

Set a project-local version (creates a .jvman file):

jvman use 17

Run with a specific version

Use exec to run a command with a specific Java version without changing your global or local settings:

jvman exec 21 java -version
jvman exec corretto-17 javac Main.java
jvman exec zulu-11 mvn clean install

This sets JAVA_HOME and prepends the JDK's bin directory to PATH for the executed command.

Interactive mode

Launch the terminal UI for browsing and managing installed versions:

jvman tui

In the TUI you can:

  • Browse installed versions
  • Press Enter to set a version as global
  • Press d to remove a version
  • Use / to filter the list
  • Press q to quit

Other commands

jvman which        # Show the currently active Java and how it was resolved
jvman remove 21    # Uninstall a version
jvman cache clear  # Clear the version cache
jvman upgrade      # Check for jvman updates
jvman version      # Show jvman version

Version Resolution

jvman resolves the active Java version in this order:

  1. .jvman file in the current directory or any parent directory
  2. Local override set in config for the current directory
  3. Global default

Shims

After installation, ~/.jvman/bin contains shims for common JDK tools:

  • java, javac, jar, jshell, javadoc, jarsigner, keytool, jlink, jpackage

These shims automatically use the resolved Java version based on your current directory.

Shell Completion

Generate shell completion scripts:

jvman completion bash > /etc/bash_completion.d/jvman   # Bash
jvman completion zsh > "${fpath[1]}/_jvman"            # Zsh
jvman completion fish > ~/.config/fish/completions/jvman.fish  # Fish

Run jvman completion <shell> --help for detailed instructions.

About

Cross Platform Java Version Manager

Topics

Resources

License

Stars

3 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors