Examples

Basic Examples

Download Java

use lighty_java::{JavaDistribution, jre_downloader};
use std::path::Path;

#[tokio::main]
async fn main() {
    let runtime_dir = Path::new("./runtimes");

    let java_path = jre_downloader::jre_download(
        runtime_dir,
        &JavaDistribution::Temurin,
        &21,
        |current, total| {
            println!("Progress: {}%", (current * 100) / total);
        }
    ).await.unwrap();

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

Run Java Program

Detect Required Version

Complete Minecraft Launcher

Multi-Distribution Support

Progress Bar Integration

Event-Driven UI

Concurrent Downloads

Version-Specific Logic

See Also

Last updated