Package: rJavaEnv 0.3.0.9000

rJavaEnv: 'Java' Environments for R Projects

Quickly install 'Java Development Kit (JDK)' without administrative privileges and set environment variables in current R session or project to solve common issues with 'Java' environment management in 'R'. Recommended to users of 'Java'/'rJava'-dependent 'R' packages such as 'r5r', 'opentripplanner', 'xlsx', 'openNLP', 'rWeka', 'RJDBC', 'tabulapdf', and many more. 'rJavaEnv' prevents common problems like 'Java' not found, 'Java' version conflicts, missing 'Java' installations, and the inability to install 'Java' due to lack of administrative privileges. 'rJavaEnv' automates the download, installation, and setup of the 'Java' on a per-project basis by setting the relevant 'JAVA_HOME' in the current 'R' session or the current working directory (via '.Rprofile', with the user's consent). Similar to what 'renv' does for 'R' packages, 'rJavaEnv' allows different 'Java' versions to be used across different projects, but can also be configured to allow multiple versions within the same project (e.g. with the help of 'targets' package). For users who need to install 'rJava' or other 'Java'-dependent packages from source, 'rJavaEnv' will display a message with instructions on how to run 'R CMD javareconf' to make the 'Java' configuration permanent, but also provides a function 'java_build_env_set' that sets the environment variables in the current R session temporarily to allow installation of 'rJava' from source without 'R CMD javareconf'. On 'Linux', in addition to setting environment variables, 'rJavaEnv' also dynamically loads 'libjvm.so' to ensure 'rJava' works correctly. See documentation for more details.

Authors:Egor Kotov [aut, cre, cph], Chung-hong Chan [aut], Mauricio Vargas [ctb], Hadley Wickham [ctb], Enrique Mondragon-Estrada [ctb], Jonas Lieth [ctb]

rJavaEnv_0.3.0.9000.tar.gz
rJavaEnv_0.3.0.9000.zip(r-4.7)rJavaEnv_0.3.0.9000.zip(r-4.6)rJavaEnv_0.3.0.9000.zip(r-4.5)
rJavaEnv_0.3.0.9000.tgz(r-4.6-any)rJavaEnv_0.3.0.9000.tgz(r-4.5-any)
rJavaEnv_0.3.0.9000.tar.gz(r-4.7-any)rJavaEnv_0.3.0.9000.tar.gz(r-4.6-any)
rJavaEnv_0.3.0.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
rJavaEnv/json (API)

# Install 'rJavaEnv' in R:
install.packages('rJavaEnv', repos = c('https://e-kotov.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/e-kotov/rjavaenv/issues

Pkgdown/docs site:https://www.ekotov.pro

On CRAN:

Conda:

environmentsjavareproducibilityreproducible-researchquarto

8.03 score 24 stars 30 scripts 752 downloads 30 exports 13 dependencies

Last updated from:ae11c95f09. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK151
source / vignettesOK195
linux-release-x86_64OK151
macos-release-arm64OK178
macos-oldrel-arm64OK200
windows-develOK134
windows-releaseOK155
windows-oldrelOK184
wasm-releaseOK107

Exports:java_build_env_setjava_build_env_unsetjava_check_compatibilityjava_check_version_cmdjava_check_version_rjavajava_clearjava_clear_distribjava_clear_installedjava_clear_projectjava_downloadjava_ensurejava_env_setjava_env_unsetjava_find_systemjava_get_homejava_installjava_listjava_list_availablejava_list_distribjava_list_installedjava_list_projectjava_quick_installjava_resolvejava_unpackjava_valid_versionslocal_java_envrje_consentuse_javawith_java_envwith_rjava_env

Dependencies:backportscachemcheckmateclicurldigestfastmapmemoiseRcppRcppSimdJsonrlangwithryaml

Quick Start Guide: Java Setup for 'R' Projects
1. Quickly Download and Install Java | Install rJavaEnv | Quick Install Java JDK | 2. List Available Java Versions | 3. Check Java installation | Note for Linux users | 4. Return things to their original state | Unset Java | Delete Java from the project directory | 5. Complete Cleanup

Last update: 2026-01-13
Started: 2024-08-20

Step-by-step: Download, Install, and Setup Java for 'R' Projects
1. Set-up cache folder location | 2. List available Java versions | 3. Download Java JDK distributions | 4. Manage downloaded Java JDK distributions | 5. Install from downloaded Java JDK distributions into current project | 6. Manually set installed Java environment | 7. Cleanup

Last update: 2026-01-13
Started: 2024-08-20

Install rJava from source
1. Install Java | 2. Set the environment for building rJava | 3. Install rJava from source | Order Matters: use_java() Before library(rJava)

Last update: 2025-12-30
Started: 2025-09-07

Using rJavaEnv in R Packages
The Critical Decision: Does Your Package Use rJava? | Scenario A: Packages Using Command-Line Java (No rJava) | Recommended Pattern: local_java_env() | Using with_java_env() | Performance: Using .use_cache | Controlling Whether to Use System Java | Scenario B: Packages Importing rJava | Pattern 1: The Guard (Recommended) | Pattern 2: Process Isolation (Advanced) | Choosing Between use_java and java_ensure | Strategy: "Inform and Guide" | 1. Add rJavaEnv to Imports | 2. Document the Requirement | 3. Optional: Provide a Setup Helper | Performance & Caching | When to use .use_cache = TRUE | Debugging | CI/CD (GitHub Actions)

Last update: 2025-12-30
Started: 2025-12-30

Multiple Java environments in one project with targets and callr
How to use use_java() | How to use with targets and callr

Last update: 2025-09-07
Started: 2024-08-28

Readme and manuals

Help Manual

Help pageTopics
Set up the environment for building R packages with Java dependencies from sourcejava_build_env_set
Unset the Java build environment variables in the project .Rprofilejava_build_env_unset
Verify rJava Compatibility (Guard)java_check_compatibility
Check installed Java version using terminal commandsjava_check_version_cmd
Check Java Version with a Specified JAVA_HOME Using a Separate R Sessionjava_check_version_rjava
Manage Java installations and distributions cachesjava_clear
Clear the Java distributions cache folderjava_clear_distrib
Clear the Java installations cache folderjava_clear_installed
Clear the Java versions symlinked in the current projectjava_clear_project
Download a Java distributionjava_download
Ensure specific Java version is setjava_ensure
Set the 'JAVA_HOME' and 'PATH' environment variables to a given pathjava_env_set
Unset the JAVA_HOME and PATH environment variables in the project .Rprofilejava_env_unset
Discover system-wide Java installationsjava_find_system
Get JAVA_HOMEjava_get_home
Install Java from a distribution filejava_install
List the contents of the Java versions installed or cachedjava_list
List Available Java Versionsjava_list_available
List the contents of the Java distributions cache folderjava_list_distrib
List the contents of the Java installations cache folderjava_list_installed
List the Java versions symlinked in the current projectjava_list_project
Download and install and set Java in current working/project directoryjava_quick_install
Resolve path to specific Java versionjava_resolve
Unpack a Java distribution file into cache directoryjava_unpack
Retrieve Valid Java Versionsjava_valid_versions
Set Java environment for the current scopelocal_java_env
Obtain User Consent for rJavaEnvrje_consent
Install specified Java version and set the 'JAVA_HOME' and 'PATH' environment variables in current R sessionuse_java
Execute code with a specific Java environmentwith_java_env
Execute rJava code in a separate process with specific Java versionwith_rjava_env