Installation Guide

Download Process

Basic Download

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| {
            let percent = (current * 100) / total;
            println!("Download: {}%", percent);
        }
    ).await.unwrap();

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

With Progress Tracking

With Event System

Installation Flow

spinner

Directory Structure

Before Installation

After Installation

Finding Existing Installation

Check if Java is already installed before downloading:

Installation Naming

Runtime directories follow this pattern:

Examples:

  • temurin_8/ - Temurin Java 8

  • graalvm_21/ - GraalVM Java 21

  • zulu_17/ - Zulu Java 17

  • liberica_11/ - Liberica Java 11

Archive Extraction

Windows (ZIP)

Linux/macOS (TAR.GZ)

Binary Location

After extraction, the Java binary is located at:

Windows:

macOS:

Linux:

Permissions (Unix)

On Linux and macOS, the binary needs execution permissions:

Error Handling

Download Errors

Network Retry

The download system automatically retries on network errors:

Disk Space Requirements

Ensure sufficient disk space before downloading:

Distribution
Java 8
Java 11
Java 17
Java 21

Temurin

~120 MB

~250 MB

~275 MB

~300 MB

GraalVM

N/A

N/A

~450 MB

~475 MB

Zulu

~125 MB

~260 MB

~290 MB

~315 MB

Liberica

~100 MB

~240 MB

~265 MB

~290 MB

Space includes:

  • Downloaded archive

  • Extracted files

  • 10% buffer for safety

Cleanup

Remove old Java installations:

Concurrent Downloads

Multiple Java versions can be downloaded concurrently:

See Also

Last updated