
Check Java Version with a Specified JAVA_HOME Using a Separate R Session
Source:R/java_env.R
java_check_version_rjava.RdThis 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.
Arguments
- java_home
Path to Java home directory. If NULL, the function uses the JAVA_HOME environment variable.
- quiet
A
logicalvalue indicating whether to suppress messages. Can beTRUEorFALSE.- .use_cache
Logical. If
TRUE, uses cached results for repeated calls with the same JAVA_HOME. IfFALSE(default), forces a fresh check. Set toTRUEfor performance in loops or repeated checks within the same session.