Kopi is a JDK version management tool written in Rust that integrates with your shell to seamlessly switch between different Java Development Kit versions. It fetches JDK metadata from foojay.io and provides a simple, fast interface similar to tools like volta, nvm, and pyenv.
Kopi is designed for:
JAVA_HOME
and PATH
variables.kopi-version
or .java-version
filesKopi integrates with your shell to intercept Java commands and automatically route them to the correct JDK version. It fetches available JDK distributions from foojay.io, a comprehensive OpenJDK discovery service.
βββββββββββββββ ββββββββββββββββ βββββββββββββββββ
β Your Shell ββββββΆβ Kopi Shims ββββββΆβ Active JDK β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββ
β
βΌ
ββββββββββββββββ
β .kopi-versionβ
ββββββββββββββββ
# Install kopi (coming soon to package managers)
cargo install kopi
# Initial setup - creates directories and installs shims
kopi setup
# Add shims directory to your PATH (in ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish)
export PATH="$HOME/.kopi/shims:$PATH"
# Install a JDK
kopi install 21 # Latest JDK 21 (Eclipse Temurin by default)
kopi install temurin@17 # Specific distribution and version
kopi install corretto@11.0.21 # Exact version
# List installed JDKs
kopi list
# Set global default
kopi global 21
# Set project-specific version
cd my-project
kopi local 17 # Creates .kopi-version file
# Show current JDK
kopi current
# Uninstall a JDK
kopi uninstall temurin@21 # Remove specific version
kopi uninstall corretto --all # Remove all Corretto versions
Kopi automatically detects and uses JDK versions from configuration files in your project:
.kopi-version
(Recommended)temurin@21
.java-version
(Compatibility)17.0.9
When you cd
into a project directory, kopi automatically switches to the configured JDK version.
kopi search 21 # Search for JDK 21 variants
kopi search corretto # List all Corretto versions
kopi search 21 --lts-only # Show only LTS versions
kopi search 21 --detailed # Show full details
# Set JDK for current shell session
eval "$(kopi shell 21)" # Bash/Zsh
kopi shell 21 | source # Fish
kopi shell 21 | Invoke-Expression # PowerShell
kopi cache refresh # Update metadata from foojay.io
kopi cache info # Show cache details
kopi cache clear # Remove cached metadata
kopi shim list # List installed shims
kopi shim add native-image # Add shim for GraalVM tool
kopi shim verify # Check shim integrity
Kopi supports JDKs from multiple vendors:
Run kopi cache list-distributions
to see all available distributions.
Kopi stores global settings in ~/.kopi/config.toml
:
# Default distribution for installations
default_distribution = "temurin"
# Additional custom distributions
additional_distributions = ["company-jdk"]
[storage]
# Minimum required disk space in MB
min_disk_space_mb = 500
KOPI_HOME
- Override default kopi home directory (default: ~/.kopi
)HTTP_PROXY
/ HTTPS_PROXY
- Proxy configuration for downloadsNO_PROXY
- Hosts to bypass proxyKopi is designed with performance and reliability in mind:
Feature | Kopi | SDKMAN! | jenv | jabba |
---|---|---|---|---|
Written in | Rust | Bash | Bash | Go |
Performance | β‘ Fast | Moderate | Moderate | Fast |
Auto-switching | β | β | β | β |
Multiple vendors | β | β | β | β |
Offline support | β | β | β | β |
Windows support | β | β | β | β |
Shell integration | β | β | β | β |
cargo install sccache
git clone https://github.com/your-org/kopi.git
cd kopi
# Development build
cargo build
# Run tests
cargo test
# Release build
cargo build --release
We welcome contributions! Please see our Contributing Guidelines for details.
When completing any coding task:
cargo fmt
to format codecargo clippy
to check for improvementscargo check
for fast error checkingcargo test --lib
to run unit testsAll commands must pass without errors before considering work complete.
Kopi is licensed under the Apache License 2.0. See LICENSE for details.
Built with β€οΈ by the Kopi team