A Rust-based JDK version manager that helps you easily install, switch, and manage multiple JDK versions on Windows.
Java-Mocha is a Java version management tool developed based on the Foojay API. It supports JDK version management through a command-line interface and can also be integrated and used via the API.
Currently, it only supports Oracle and Oracle OpenJDK. If you need to support more JDK vendors or have other improvements, please submit an issue.
Support scoop installation.
# Install the package
scoop bucket add code https://github.com/morning-start/code-bucket
scoop install code/jvm
# Update the package
scoop update jvm- Configuration Management: Configure JDK directories, cache directories, and proxy servers.
- Data Synchronization: Synchronize JDK data from Foojay to a local JSON file.
- List Display: View local JDKs, publishers, and version information.
- Query Function: Query available JDKs based on publishers, version numbers, and support periods.
- Installation and Uninstallation: Install and uninstall specified JDK versions.
- Version Switching: Switch the JAVA_HOME environment variable to point to a different JDK version.
To build and run the project from source, you need to have Rust installed on your system.
# Clone the repository
git clone https://github.com/morning-start/java-mocha.git
cd java-mocha
# Build the project
cargo build --release
# Run the project
cargo run --releaseYou can configure the JVM_ROOT environment variable in advance to control the installation directory. The default value is %USERPROFILE%\.java-mocha.
Notes:
- Before use, manually configure the
JAVA_HOMEenvironment variable toJVM_ROOT/default. - On first use, synchronize the data to obtain the latest JDK data information.
Characteristics:
- No system permissions are required for use.
- The software automatically acquires system and architecture information to obtain the corresponding JDK version.
- JDK information is based on the foojay Disco API, providing better scalability.
- The default is production-free JDKs, excluding commercial versions.
- Currently, it only handles JDKs without JavaFX.
- Supported JDK vendors are as follows:
- Oracle
- Oracle OpenJDK
jvm configjvm sync# View local JDKs
jvm list
# View publisher information
jvm list --publisher
# View version information
jvm list --version# Query by publisher
jvm query oracle
# Query by publisher and version number
jvm query oracle -v 23
# Query by publisher and support period
jvm query oracle -t stsjvm install oracle@23jvm switch oracle@23.0.1jvm uninstall oracle@23.0.1For more detailed information, please refer to the Development Documentation.
