Skip to content

Commit 5d3d1ac

Browse files
committed
update the approach to check if rJava is init, thanks Hadley!
1 parent 5b1b837 commit 5d3d1ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

R/java_env.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ java_env_set_session <- function(java_home) {
8585

8686
# check if rJava is installed and alread initialized
8787
if (requireNamespace("rJava", quietly = TRUE)) {
88-
if( rJava:::.jniInitialized == TRUE ) {
88+
if( getFromNamespace(".jniInitialized", "rJava") == TRUE ) {
8989
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."))
9090
}
9191
}

0 commit comments

Comments
 (0)