Skip to contents

Download a Java distribution

Usage

java_download(
  version = 21,
  distribution = "Corretto",
  dest_dir = tools::R_user_dir("rJavaEnv", which = "cache"),
  platform = platform_detect()$os,
  arch = platform_detect()$arch,
  verbose = TRUE
)

Arguments

version

The Java version to download. If not specified, defaults to the latest LTS version.

distribution

The Java distribution to download. If not specified, defaults to "Corretto".

dest_dir

The destination directory to download the Java distribution to. Defaults to a user-specific data directory.

platform

The platform for which to download the Java distribution. Defaults to the current platform.

arch

The architecture for which to download the Java distribution. Defaults to the current architecture.

verbose

Whether to print detailed messages. Defaults to TRUE.

Value

The path to the downloaded Java distribution file.

Examples

if (FALSE) {
java_download(version = "17", distribution = "Corretto")
java_download(distribution = "Corretto")
java_download()
}