Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
667793f
add rdocdump line to quickly dump package code to txt
e-kotov Sep 7, 2025
6e4d13d
add dyn.load for Linux
e-kotov Sep 7, 2025
32527ea
autofind libjvm.so
e-kotov Sep 7, 2025
60605eb
set env vars for building rJava from source
e-kotov Sep 7, 2025
e09e44b
fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
ccd16a4
further fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
d067a22
further fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
c480dd7
further fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
41861f6
further fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
a21a819
further fixes for building rJava from source on Linux
e-kotov Sep 7, 2025
5216534
add warning about missing rlang
e-kotov Sep 7, 2025
2cd485b
help macos find java for building rJava from source
e-kotov Sep 7, 2025
afdeac7
help macos find java for building rJava from source
e-kotov Sep 7, 2025
bf0078c
help macos find java for building rJava from source
e-kotov Sep 7, 2025
5c70df3
help macos find java for building rJava from source
e-kotov Sep 7, 2025
64fbddf
separate build env code into standalone function
e-kotov Sep 7, 2025
f901577
separate build env code into standalone function
e-kotov Sep 7, 2025
1ce2dfd
modular design
e-kotov Sep 7, 2025
4128555
simplify
e-kotov Sep 7, 2025
580b974
Reimplement dyn.load back for linux
e-kotov Sep 7, 2025
0b25e30
build env set, messaging, cleanup
e-kotov Sep 7, 2025
93ef454
experimental
e-kotov Sep 7, 2025
83a83ec
updated namespace
e-kotov Sep 7, 2025
d818ed9
final cleanup
e-kotov Sep 7, 2025
8593d06
typos
e-kotov Sep 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 60 additions & 17 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,31 @@ message: 'To cite package "rJavaEnv" in publications use:'
type: software
license: MIT
title: 'rJavaEnv: ''Java'' Environments for R Projects'
version: 0.3.0
version: 0.3.0.9000
doi: 10.32614/CRAN.package.rJavaEnv
identifiers:
- type: doi
value: 10.32614/CRAN.package.rJavaEnv
abstract: 'Quickly install ''Java Development Kit (JDK)'' without administrative privileges
abstract: 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). Note: there are a few extra steps for ''Linux'' users, who don''t have
any ''Java'' previously installed in their system, and who prefer package installation
from source, rather then installing binaries from ''Posit Package Manager''. See
documentation for details.'
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:
- family-names: Kotov
given-names: Egor
Expand Down Expand Up @@ -131,6 +134,21 @@ references:
orcid: https://orcid.org/0000-0002-4035-0289
year: '2025'
doi: 10.32614/CRAN.package.jsonlite
- type: software
title: rlang
abstract: 'rlang: Functions for Base Types and Core R and ''Tidyverse'' Features'
notes: Imports
url: https://rlang.r-lib.org
repository: https://CRAN.R-project.org/package=rlang
authors:
- family-names: Henry
given-names: Lionel
email: lionel@posit.co
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
year: '2025'
doi: 10.32614/CRAN.package.rlang
- type: software
title: utils
abstract: 'R: A Language and Environment for Statistical Computing'
Expand Down Expand Up @@ -183,4 +201,29 @@ references:
year: '2025'
doi: 10.32614/CRAN.package.testthat
version: '>= 3.0.0'
- type: software
title: withr
abstract: 'withr: Run Code ''With'' Temporarily Modified Global State'
notes: Suggests
url: https://withr.r-lib.org
repository: https://CRAN.R-project.org/package=withr
authors:
- family-names: Hester
given-names: Jim
- family-names: Henry
given-names: Lionel
email: lionel@posit.co
- family-names: Müller
given-names: Kirill
email: krlmlr+r@mailbox.org
- family-names: Ushey
given-names: Kevin
email: kevinushey@gmail.com
- family-names: Wickham
given-names: Hadley
email: hadley@posit.co
- family-names: Chang
given-names: Winston
year: '2025'
doi: 10.32614/CRAN.package.withr

16 changes: 11 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ Description: Quickly install 'Java Development Kit (JDK)' without
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). Note: there are a
few extra steps for 'Linux' users, who don't have any 'Java'
previously installed in their system, and who prefer package
installation from source, rather then installing binaries from 'Posit
Package Manager'. See documentation for details.
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.
License: MIT + file LICENSE
URL: https://github.com/e-kotov/rJavaEnv, https://www.ekotov.pro/rJavaEnv/
BugReports: https://github.com/e-kotov/rJavaEnv/issues
Expand All @@ -45,6 +50,7 @@ Imports:
cli,
curl,
jsonlite,
rlang,
utils
Suggests:
quarto,
Expand Down
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Generated by roxygen2: do not edit by hand

export(java_build_env_set)
export(java_build_env_unset)
export(java_check_version_cmd)
export(java_check_version_rjava)
export(java_clear)
Expand All @@ -13,5 +15,6 @@ export(java_unpack)
export(java_valid_versions)
export(rje_consent)
export(use_java)
import(rlang)
importFrom(utils,getFromNamespace)
importFrom(utils,installed.packages)
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# rJavaEnv (development version)

## 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.

# rJavaEnv 0.3.0

## New features
Expand Down
Loading
Loading