R/get_default_java_path.R

Defines functions get_default_java_path

Documented in get_default_java_path

#' Obtains the default path to the Java executable
#' @inheritParams default_params_doc
#' @return the default path to the Java executable
#' @author Richèl J.C. Bilderbeek
#' @export
get_default_java_path <- function(
  os = rappdirs::app_dir()$os
) {
  beastier::check_os(os)
  rJava::.jinit()
  java_folder <- rJava::.jcall(
    "java/lang/System", "S", "getProperty", "java.home"
  )
  testit::assert(dir.exists(java_folder))
  java_path <- file.path(java_folder, "bin", "java.exe")
  if (os != "win") {
    java_path <- file.path(java_folder, "bin", "java")
  }
  testit::assert(file.exists(java_path))
  normalizePath(java_path, mustWork = TRUE)
}

Try the beastier package in your browser

Any scripts or data that you put into this service are public.

beastier documentation built on Sept. 19, 2021, 5:06 p.m.