Kopi - JDK Version Manager
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 uses a multi-source metadata system with pre-generated metadata files and the Foojay API for comprehensive JDK availability, providing a simple, fast interface similar to tools like volta, nvm, and pyenv.
Who is this for?
Kopi is designed for:
- Java developers who work with multiple projects requiring different JDK versions
- Teams needing consistent JDK environments across development machines
- DevOps engineers who want to automate JDK version management in CI/CD pipelines
- Anyone tired of manually managing
JAVA_HOMEandPATHvariables
Key Features
- π Fast Performance - Built with Rust for minimal overhead and instant JDK switching
- π Automatic Version Switching - Detects and switches JDK versions based on project configuration
- π¦ Multiple Distribution Support - Install JDKs from various vendors (Eclipse Temurin, Amazon Corretto, Azul Zulu, GraalVM, and more)
- π‘οΈ Shell Integration - Transparent version management through shims - no manual PATH configuration needed
- π Project Pinning - Lock JDK versions per project using
.kopi-versionor.java-versionfiles - π Smart Caching - Efficient metadata caching for fast searches and offline support
- ποΈ Easy Uninstall - Remove JDKs with automatic cleanup of metadata and shims
- π― Cross-Platform - Works on macOS, Linux, and Windows
How it Works
Kopi integrates with your shell to intercept Java commands and automatically route them to the correct JDK version. It uses a multi-source metadata system that fetches JDK information from both pre-generated metadata files hosted at kopi-vm.github.io for optimal performance and the Foojay API for real-time availability of the latest JDK releases.
βββββββββββββββ ββββββββββββββββ βββββββββββββββββ
β Your Shell ββββββΆβ Kopi Shims ββββββΆβ Active JDK β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββ
β
βΌ
ββββββββββββββββ
β .kopi-versionβ
ββββββββββββββββ
Quick Start
Installation
# Install kopi (coming soon to package managers)
# Initial setup - creates directories and installs shims
# Add shims directory to your PATH (in ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish)
Basic Usage
# Install a JDK
# List installed JDKs
# Set global default
# Set project-specific version
# Creates .kopi-version file
# Show current JDK
# Show installation path
# Uninstall a JDK
Project Configuration
Kopi automatically detects and uses JDK versions from configuration files in your project:
.kopi-version (Recommended)
temurin@21
.java-version (Compatibility)
17.0.9
Advanced Features
Search Available JDKs
# Note: 'search' is an alias for 'cache search'
Shell Environment
# Launch new shell with specific JDK
# Launches new shell with Java 21 active
# Or use the env command for shell evaluation (like direnv)
| # Fish shell
|
Cache Management
# Shortcuts:
Shim Management
Diagnostics
Supported Distributions
Kopi supports JDKs from multiple vendors:
- temurin - Eclipse Temurin (formerly AdoptOpenJDK) - default
- corretto - Amazon Corretto
- zulu - Azul Zulu
- openjdk - OpenJDK
- graalvm - GraalVM
- dragonwell - Alibaba Dragonwell
- sapmachine - SAP Machine
- liberica - BellSoft Liberica
- mandrel - Red Hat Mandrel
- kona - Tencent Kona
- semeru - IBM Semeru
- trava - Trava OpenJDK
Run kopi cache list-distributions to see all available distributions in your cache.
Configuration
Global Configuration
Kopi stores global settings in ~/.kopi/config.toml:
# Default distribution for installations
= "temurin"
# Additional custom distributions
= ["company-jdk"]
[]
# Minimum required disk space in MB
= 500
Environment Variables
KOPI_HOME- Override default kopi home directory (default:~/.kopi)KOPI_JAVA_VERSION- Override JDK version for current shell sessionHTTP_PROXY/HTTPS_PROXY- Proxy configuration for downloadsNO_PROXY- Hosts to bypass proxyRUST_LOG- Enable debug logging (e.g.,RUST_LOG=debug kopi install 21)
Architecture
Kopi is designed with performance and reliability in mind:
- Written in Rust - Memory safe, fast, and efficient
- Minimal Dependencies - Quick installation and low overhead
- Smart Caching - Hybrid online/offline metadata management
- Atomic Operations - Safe concurrent JDK installations
- Shell Integration - Works with bash, zsh, fish, and PowerShell
Comparison with Similar Tools
| 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 | β | β | β | β |
Development
Prerequisites
- Rust toolchain (1.70+)
- sccache (recommended):
cargo install sccache
Building from Source
# Development build
# Run tests
# Release build
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Workflow
When completing any coding task:
- Run
cargo fmtto format code - Run
cargo clippy --all-targets -- -D warningsto check for improvements - Run
cargo test --lib --quietto run unit tests - Submit a pull request
All commands must pass without errors before considering work complete.
Documentation
- User Reference - Complete command reference with detailed examples
- Architecture Decision Records - Design decisions and rationale
License
Kopi is licensed under the Apache License 2.0. See LICENSE for details.
Acknowledgments
- JDK metadata originally sourced from foojay.io and optimized for fast access
- Inspired by volta, nvm, and pyenv
Built with β€οΈ by the Kopi team