diff --git a/.Rprofile b/.Rprofile index 4405347..fb0e136 100644 --- a/.Rprofile +++ b/.Rprofile @@ -1,3 +1,25 @@ source("renv/activate.R") if (Sys.getenv("RUSER") == "DHERSZ") source("~/.Rprofile") + +# rJavaEnv begin: Manage JAVA_HOME +if (dir.exists("rjavaenv")) { + platform <- list.files("rjavaenv") + arch <- list.files(file.path("rjavaenv", platform)) + version <- "11" + + rjavaenv_cache_dir <- tools::R_user_dir("rJavaEnv", "cache") + + java_home_path <- file.path( + rjavaenv_cache_dir, + "installed", + platform, arch, version + ) + + Sys.setenv(JAVA_HOME = java_home_path) + old_path <- Sys.getenv('PATH') # rJavaEnv + new_path <- file.path(Sys.getenv('JAVA_HOME'), 'bin') # rJavaEnv + Sys.setenv(PATH = paste(new_path, old_path, sep = .Platform$path.sep)) # rJavaEnv + rm(old_path, new_path) # rJavaEnv +} +# rJavaEnv end: Manage JAVA_HOME diff --git a/.gitignore b/.gitignore index 11dc8b8..190dff2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ site_libs/ *.docx /docx_en_freeze/ /docx_pt_freeze/ +rjavaenv/