You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/java_download.R
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
#' Download a Java distribution
2
2
#'
3
-
#' @param version The Java version to download. If not specified, defaults to the latest LTS version.
4
-
#' @param distribution The Java distribution to download. If not specified, defaults to "Corretto".
3
+
#' @param version `Integer` or `character` vector of length 1 for major version of Java to download or install. If not specified, defaults to the latest LTS version. Can be "8", "11", "17", "21", "22", or 8, 11, 17, 21, or 22.
4
+
#' @param distribution The Java distribution to download. If not specified, defaults to "Amazon Corretto". Currently only \href{https://aws.amazon.com/corretto/}{"Amazon Corretto"} is supported.
5
5
#' @param cache_path The destination directory to download the Java distribution to. Defaults to a user-specific data directory.
6
6
#' @param platform The platform for which to download the Java distribution. Defaults to the current platform.
7
7
#' @param arch The architecture for which to download the Java distribution. Defaults to the current architecture.
cli::cli_inform(c("!"="You have already initialised `rJava` directly or via your Java-dependent R package in the current session. `Java` version can only be set once per session for packages that rely on `rJava`. Unless you restart the R session or run your code in a new R subprocess using `targets` or `callr`, the new `JAVA_HOME` and `PATH` will not take effect."))
#' Check Java Version with a Specified JAVA_HOME Using a Separate R Session
139
147
#'
140
-
#' This function sets the JAVA_HOME environment variable, initializes the JVM using rJava,
141
-
#' and prints the Java version that would be used if the user sets the given JAVA_HOME
142
-
#' in the current R session. This check is performed in a separate R session to avoid
143
-
#' having to reload the current R session. The reason for this is that once Java is initialized in an R session,
144
-
#' it cannot be uninitialized unless the current R session is restarted.
148
+
#' This function sets the JAVA_HOME environment variable, initializes the JVM using rJava, and prints the Java version that would be used if the user sets the given JAVA_HOME in the current R session. This check is performed in a separate R session to avoid having to reload the current R session. The reason for this is that once Java is initialized in an R session, it cannot be uninitialized unless the current R session is restarted.
145
149
#'
146
-
#' @param java_home The path to the desired JAVA_HOME. If NULL, uses the current JAVA_HOME environment variable.
147
150
#' @inheritParams global_quiet_param
148
-
#' @return TRUE if successful, otherwise FALSE.
151
+
#' @inheritParams java_check_version_cmd
152
+
#' @return A `character` vector of length 1 containing the major Java version.
Copy file name to clipboardExpand all lines: R/java_install.R
+15-62Lines changed: 15 additions & 62 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,11 @@
1
1
#' Install Java from a distribution file
2
2
#'
3
-
#' @param java_distrib_path The path to the Java distribution file.
4
-
#' @param project_path The project directory where Java should be installed. If not specified or `NULL`, defaults to the current working directory.
5
-
#' @param autoset_java_env Whether to set the `JAVA_HOME` and `PATH` environment variables to the installed Java directory. Defaults to `TRUE`.
3
+
#' @description
4
+
#' Unpack Java distribution file into cache directory and link the installation into a project directory, optionally setting the `JAVA_HOME` and `PATH` environment variables to the Java version that was just installed.
5
+
#'
6
+
#' @param java_distrib_path A `character` vector of length 1 containing the path to the Java distribution file.
7
+
#' @param project_path A `character` vector of length 1 containing the project directory where Java should be installed. If not specified or `NULL`, defaults to the current working directory.
8
+
#' @param autoset_java_env A `logical` indicating whether to set the `JAVA_HOME` and `PATH` environment variables to the installed Java directory. Defaults to `TRUE`.
6
9
#' @inheritParams java_download
7
10
#' @inheritParams global_quiet_param
8
11
#' @return The path to the installed Java directory.
0 commit comments