Skip to content

Commit

Permalink
fix namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kotov committed Sep 13, 2024
1 parent 96445db commit df72be4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export(java_unpack)
export(rje_consent)
export(use_java)
importFrom(utils,getFromNamespace)
importFrom(utils,installed.packages)
3 changes: 2 additions & 1 deletion R/java_env.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ java_env_set <- function(
#'
#' @param java_home The path to the desired JAVA_HOME.
#' @keywords internal
#' @importFrom utils installed.packages
#'
java_env_set_session <- function(java_home) {

# check if rJava is installed and alread initialized
if (any(installed.packages()[, 1] == "rJava")) {
if (any(utils::installed.packages()[, 1] == "rJava")) {
if( "rJava" %in% loadedNamespaces() == TRUE ) {
cli::cli_inform(c("!" = "You have `rJava` R package loaded in the current session. If you have already initialised it directly with ``rJava::.jinit()` or via your Java-dependent R package in the current session, you may not be able to switch to a different `Java` version unless you restart R. `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."))
}
Expand Down

0 comments on commit df72be4

Please sign in to comment.