Crate corretto

Source
Expand description

§Library for installing and finding info about Corretto OpenJDK

Crates.io Downloads Documentation License Dependency Status

Get programmatic access to the Corretto OpenJDK distributions.

According to Amazon,

Amazon Corretto is a no-cost, multiplatform, production-ready distribution of the Open Java Development Kit (OpenJDK). Corretto comes with long-term support that includes performance enhancements and security fixes. Corretto is certified as compatible with the Java SE standard and is used internally at Amazon for many production services. With Corretto, you can develop and run Java applications on operating systems such as Amazon Linux 2, Windows, and macOS.

§Usage

use corretto::{VersionInfo, Version, Os, CpuArch, Ext, JdkDesc, DownloadError};

#[tokio::main]
async fn main() -> Result<(), DownloadError> {
    let version_info = VersionInfo::fetch().await?;
    let latest_lts = version_info.latest_lts();
    let jdk_desc = JdkDesc::new(
        latest_lts,
        CpuArch::X64,
        Os::Linux,
        Ext::TarGz,
    );
    let download_url = jdk_desc.url();
    let path = download_url.download_tmp().await?;
    // ..
    Ok(())
}

Structs§

DownloadOpts
Options for downloading a JDK.
DownloadURL
A URL from which a JDK can be downloaded.
JdkDesc
A struct describing a Corretto JDK.
Version
A newtype wrapper around a version of Corretto distribution of Open Java Development Kit (OpenJDK).
VersionInfo
A struct describing the data from https://github.com/corretto/corretto-downloads/blob/ace4e5da8accabdcd7a214d86dbbdb7417fbf11a/latest_links/version-info.json.

Enums§

CpuArch
A CPU architecture.
DownloadError
An error that can occur while downloading a JDK.
Ext
A file extension.
Os
An operating system.