Skip to content

Add Linux support for easy rJava loading, add env setting for building rJava from source an all platforms#84

Merged
e-kotov merged 25 commits intomainfrom
linux
Sep 7, 2025
Merged

Add Linux support for easy rJava loading, add env setting for building rJava from source an all platforms#84
e-kotov merged 25 commits intomainfrom
linux

Conversation

@e-kotov
Copy link
Owner

@e-kotov e-kotov commented Sep 7, 2025

New features

  • Linux support. On Linux, libjvm.so location is automatically detected and force-loaded via dyn.load(). Thanks to that, rJava and any depenent R packages can be installed and loaded, if repositories with pre-built packages, such as Posit Package Manager, is used or if you build rJava from source, see the java_build_env_set() function.

  • New function java_build_env_set() that sets the environment (either temporarily in the current session or in ./.Rprofile file of the current working directory) to build rJava from source on macOS, Linux and Windows platforms. It uses the current value of JAVA_HOME environment variable by default, so that it is more convenient to use after java_quick_install() or use_java() commands. After running java_build_env_set(), users can install rJava from source with install.packages("rJava", type = "source") without any additional configuration. However, users will still need some system dependencies, e.g. on Linux they will need: libpcre2-dev, libdeflate-dev, libzstd-dev, liblzma-dev, libbz2-dev, zlib1g-dev, libicu-dev. A system message with a suggested apt-get command is printed. On Windows, Rtools must be installed. On macOS, Xcode Command Line Tools must be installed. See the new vignette Install 'rJava' from source for more details.

Improvements

  • java_quick_install() now also invisibly returns the path to JAVA_HOME.

  • Added {rlang} as a dependency, as {cli} uses it anyway for the functions that we use in {rJavaEnv}, but does not declare it as a dependency. Therefore this previously might have caused annoyances to the users, as after installing {rJavaEnv} they could not use any of the functions until they installed {rlang} manually.

  • Other minor bugfixes.

Will close #3 and #16 . java_build_env_set() function is as much as we can do. If the user does not have enough privileges to install required build tools on their system or inside a container, there is nothing else we can do.

@e-kotov e-kotov linked an issue Sep 7, 2025 that may be closed by this pull request
@e-kotov e-kotov merged commit ce8868e into main Sep 7, 2025
6 of 7 checks passed
@e-kotov e-kotov deleted the linux branch December 8, 2025 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

consider the R CMD javareconf

1 participant