3 unstable releases

0.8.6 Dec 14, 2025
0.8.2 Dec 14, 2025
0.6.2 Dec 2, 2025

#8 in #lighty-launcher


Used in 3 crates

MIT license

74KB
1.5K SLoC

lighty-java

Java runtime management for LightyLauncher.

Note

This is an internal crate for the LightyLauncher ecosystem. Most users should use the main lighty-launcher crate instead.

Features

  • Automatic JRE Download: Download and install Java runtimes on demand
  • Multiple Distributions: Support for Temurin, GraalVM, Zulu, and Liberica
  • Version Detection: Detect required Java version for Minecraft
  • Cross-Platform: Windows, Linux, and macOS support

Usage

[dependencies]
lighty-java = "0.6.3"
use lighty_java::{JavaDistribution, jre_downloader};
use directories::ProjectDirs;

#[tokio::main]
async fn main() {
    let launcher_dir = ProjectDirs::from("com", "MyLauncher", "").unwrap();

    // Download Java 21 (Temurin)
    let java_path = jre_downloader::jre_download(
        21,
        JavaDistribution::Temurin,
        &launcher_dir
    ).await?;

    println!("Java installed at: {}", java_path.display());
}

Structure

lighty-java/
└── src/
    ├── lib.rs              # Module declarations and re-exports
    ├── distribution/       # Java distribution providers
    │   ├── mod.rs          # Distribution types and main API
    │   ├── api_models.rs   # API response structures
    │   ├── utils.rs        # Shared utilities
    │   └── providers/      # Individual distribution providers
    │       ├── temurin.rs  # Adoptium Temurin provider
    │       ├── graalvm.rs  # Oracle GraalVM provider
    │       ├── zulu.rs     # Azul Zulu provider
    │       └── liberica.rs # BellSoft Liberica provider
    ├── jre_downloader.rs   # Download and install JRE
    ├── runtime.rs          # Java version detection and validation
    └── errors.rs           # Error types for Java operations

Supported Distributions

Eclipse Temurin - OpenJDK builds from the Adoptium project.

use lighty_java::JavaDistribution;

let distribution = JavaDistribution::Temurin;

Supported Versions: 8, 11, 17, 21 Best for: General use, maximum compatibility

GraalVM

GraalVM - High-performance JDK with advanced optimizations.

use lighty_java::JavaDistribution;

let distribution = JavaDistribution::GraalVM;

Supported Versions: 17, 21 Best for: Modern Minecraft versions (1.17+), maximum performance

Zulu

Azul Zulu - OpenJDK builds with enterprise support available.

use lighty_java::JavaDistribution;

let distribution = JavaDistribution::Zulu;

Supported Versions: 8, 11, 17, 21 Best for: Enterprise environments, certified builds

Liberica

BellSoft Liberica - Lightweight OpenJDK distribution.

use lighty_java::JavaDistribution;

let distribution = JavaDistribution::Liberica;

Supported Versions: 8, 11, 17, 21 Best for: Resource-constrained systems, lightweight deployments

Platform Support

Platform Architectures Status
Windows x64, ARM64 Tested
Linux x64, ARM64 Tested
macOS x64, ARM64 Tested

License

MIT

Dependencies

~17–43MB
~663K SLoC