Unpack the Java distribution file into cache directory and return the path to the unpacked Java directory with Java binaries.
Usage
java_unpack(
java_distrib_path,
distribution = NULL,
backend = NULL,
quiet = FALSE,
force = FALSE
)Arguments
- java_distrib_path
A
charactervector of length 1 containing the path to the Java distribution file.- distribution
The Java distribution name (e.g., "Corretto", "Temurin"). If NULL, attempts to read from attributes on java_distrib_path, otherwise defaults to "unknown".
- backend
The download backend used (e.g., "native", "sdkman"). If NULL, attempts to read from attributes on java_distrib_path, otherwise defaults to "unknown".
- quiet
A
logicalvalue indicating whether to suppress messages. Can beTRUEorFALSE.- force
A logical. Whether to overwrite an existing installation. Defaults to
FALSE.
Examples
if (FALSE) { # \dontrun{
# set cache dir to temporary directory
options(rJavaEnv.cache_path = tempdir())
# download Java 17 distrib and unpack it into cache dir
java_17_distrib <- java_download(version = "17")
java_home <- java_unpack(java_distrib_path = java_17_distrib)
# set the JAVA_HOME environment variable in the current session
# to the cache dir without touching any files in the current project directory
java_env_set(where = "session", java_home = java_home)
} # }
