Skip to content

Commit

Permalink
spell check, update meta
Browse files Browse the repository at this point in the history
  • Loading branch information
e-kotov committed Aug 20, 2024
1 parent bc203d9 commit 79fd94b
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ abstract: 'The ''rJavaEnv'' package addresses common issues with ''Java'' enviro
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 systemm, and who prefer package installation from source, rather then installing
in their system, and who prefer package installation from source, rather then installing
binaries from ''Posit Package Manager''. See documentation for details.'
authors:
- family-names: Kotov
Expand Down
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Description: The 'rJavaEnv' package addresses common issues with 'Java'
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 systemm, and 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.
License: MIT + file LICENSE
Expand All @@ -42,5 +42,6 @@ VignetteBuilder:
quarto
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-US
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
4 changes: 2 additions & 2 deletions R/consent.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' Obtain User Consent for rJavaEnv
#'
#' Get user consent for rJavaEnv to write and update files on the filesystem.
#' Get user consent for rJavaEnv to write and update files on the file system.
#' rJavaEnv needs permission to manage files in your project and cache directories
#' to function correctly.
#'
Expand Down Expand Up @@ -73,7 +73,7 @@ rje_consent <- function(provided = FALSE) {

#' Verify User Consent for rJavaEnv
#'
#' Ensure that the user has granted permission for rJavaEnv to manage files on their filesystem.
#' Ensure that the user has granted permission for rJavaEnv to manage files on their file system.
#'
#' The function is based on the code of the `renv` package.
#' Copyright 2023 Posit Software, PBC
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ 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
there are a few extra steps for 'Linux' users, who don’t have any 'Java'
previously installed in their systemm, and who prefer package
installation from source, rather then installing binaries from Posit
Package Manager. See [documentation](vignettes/rJavaEnv.Rmd#note-linux)
installation from source, rather then installing binaries from 'Posit
Package Manager'. See [documentation](vignettes/rJavaEnv.Rmd#note-linux)
for details.**

``` r
Expand Down Expand Up @@ -191,7 +191,7 @@ The package has several core functions:
directory.
7. `java_env_unset()`
- Remove the JAVA_HOME and PATH environment variables from the
.Rpofile file in the project directory (but not in the current R
.Rprofile file in the project directory (but not in the current R
session, please restart the session so that R picks up the system
Java).
8. `java_list()`
Expand Down Expand Up @@ -262,8 +262,8 @@ The future work includes:
version

- Possibly allow downloading several Java distributions in one function
call, e.g. different major versions of the same flavour or different
flavours of the same major version
call, e.g. different major versions of the same 'flavour' or different
'flavours' of the same major version

- Possibly add automation to get the Java that is required by specific
Java-dependent R packages
Expand All @@ -286,7 +286,7 @@ logo also contains the original R logo.

## Citation

To cite package rJavaEnv in publications use:
To cite package `rJavaEnv` in publications use:

Kotov E (2024). *rJavaEnv: Java Environments for R Projects*.
doi:10.5281/zenodo.11403010 <https://doi.org/10.5281/zenodo.11403010>,
Expand Down
40 changes: 20 additions & 20 deletions README.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ is_html <- knitr::is_html_output()

<!-- badges: end -->

The `{rJavaEnv}` package addresses common issues with `Java` environment management in `R` for users of `Java`/`{rJava}`-dependent `R` packages such as `{r5r}`, `{opentripplanner}`, `{xlsx}`, `{openNLP}`, `{rWeka}`, `{RJDBC}`, `{tabulapdf}`, and many more. It resolves 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 Development Kit` (`JDK`) 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 systemm, and who prefer package installation from source, rather then installing binaries from 'Posit Package Manager'. See [documentation](vignettes/rJavaEnv.Rmd#note-linux) for details.**
The `{rJavaEnv}` package addresses common issues with `Java` environment management in `R` for users of `Java`/`{rJava}`-dependent `R` packages such as `{r5r}`, `{opentripplanner}`, `{xlsx}`, `{openNLP}`, `{rWeka}`, `{RJDBC}`, `{tabulapdf}`, and many more. It resolves 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 Development Kit` (`JDK`) 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](vignettes/rJavaEnv.Rmd#note-linux) for details.**



Expand Down Expand Up @@ -70,18 +70,18 @@ rJavaEnv::java_quick_install(version = 21)

This will:

- download Java 21 distribution compatible with the current operating system and processor architecture into a local cache folder;
- download `Java` 21 distribution compatible with the current operating system and processor architecture into a local cache folder;

- extract the downloaded Java distribution into another cache folder;
- extract the downloaded `Java` distribution into another cache folder;

- create a symbolic link (for macOS and Linux) or junction (for Windows, if that fails, just copies the files) **rjavaenv/`platform`/`processor_architecture`/`java_version`** in the current directory/project to point to the cached installation;

- set the current session's JAVA_HOME and PATH environment variables to point to the installed (symlinked) Java distribution;
- set the current session's `JAVA_HOME` and `PATH` environment variables to point to the installed (symlinked) `Java` distribution;

- add code to .Rprofile file in the current directory/project to set JAVA_HOME and PATH environment variables when the project is opened in RStudio.
- add code to `.Rprofile` file in the current directory/project to set `JAVA_HOME` and `PATH` environment variables when the project is opened in RStudio.


As part of normal operation, rJavaEnv will update the JAVA_HOME and PATH environment variables in the current R session, the local cache in your R package library, and the `.Rprofile` file in the project/current working directory. In line with [CRAN policies](https://cran.r-project.org/web/packages/policies.html), explicit user consent is required before making these changes. Therefore, the first time you run any function from `rJavaEnv` that makes such changes, you will be asked for consent. To explicitly consent and/or to prevent interruptions in non-interactive mode, you can use the `rje_consent()` function:
As part of normal operation, `rJavaEnv` will update the `JAVA_HOME` and `PATH` environment variables in the current R session, the local cache in your R package library, and the `.Rprofile` file in the project/current working directory. In line with [CRAN policies](https://cran.r-project.org/web/packages/policies.html), explicit user consent is required before making these changes. Therefore, the first time you run any function from `rJavaEnv` that makes such changes, you will be asked for consent. To explicitly consent and/or to prevent interruptions in non-interactive mode, you can use the `rje_consent()` function:

```r
rje_consent(provided = TRUE)
Expand All @@ -98,25 +98,25 @@ The package has several core functions:
* Checks the installed Java version using terminal commands. For packages like [`opentripplanner`](https://github.com/ropensci/opentripplanner){target="_blank"}, that performs Java calls using command line.

3. `java_version_check_rjava()`
* Checks the installed Java version using `rJava` in a separate R session. For `rJava`-dependent packages such as [`r5r`](https://github.com/ipeaGIT/r5r){target="_blank"}.
* Checks the installed `Java` version using `rJava` in a separate R session. For `rJava`-dependent packages such as [`r5r`](https://github.com/ipeaGIT/r5r){target="_blank"}.

4. `java_download()`
* Downloads a specified version and distribution of Java.
* Downloads a specified version and distribution of `Java`.

5. `java_install()`
* Installs a Java distribution file into current (or user-specified) project directory.
* Installs a `Java` distribution file into current (or user-specified) project directory.

6. `java_env_set()`
* Sets the JAVA_HOME and PATH environment variables to a given path in current R session and/or in the .Rprofile file in the project directory.
* Sets the `JAVA_HOME` and `PATH` environment variables to a given path in current R session and/or in the `.Rprofile` file in the project directory.

7. `java_env_unset()`
* Remove the JAVA_HOME and PATH environment variables from the .Rpofile file in the project directory (but not in the current R session, please restart the session so that R picks up the system Java).
* Remove the `JAVA_HOME` and `PATH` environment variables from the `.Rrpofile` file in the project directory (but not in the current R session, please restart the session so that R picks up the system Java).

8. `java_list()`
* Lists all or some Java versions linked in the current project (or cached distributions or installations).
* Lists all or some `Java` versions linked in the current project (or cached distributions or installations).

9. `java_clear()`
* Removes all or some Java versions linked in the current project (or cached distributions or installations).
* Removes all or some `Java` versions linked in the current project (or cached distributions or installations).

See more details on all the functions in the [Reference](https://www.ekotov.pro/rJavaEnv/reference/index.html){target="_blank"}.

Expand All @@ -125,25 +125,25 @@ For detailed usage, see the [Quick Start Vignette](https://www.ekotov.pro/rJavaE

## Limitations

Currently, `rJavaEnv` only supports major Java versions such as 8, 11, 17, 21, 22. The download and install functions ignore the minor version of the Java distribution and just downloads the latest stable subversion of the specified major version. This is done to simplify the process and avoid the need to update the package every time a new minor version of Java is released. For most users this should be sufficient, but this is substandard for full reproducibility.
Currently, `rJavaEnv` only supports major `Java` versions such as 8, 11, 17, 21, 22. The download and install functions ignore the minor version of the `Java` distribution and just downloads the latest stable subversion of the specified major version. This is done to simplify the process and avoid the need to update the package every time a new minor version of `Java` is released. For most users this should be sufficient, but this is substandard for full reproducibility.

The main limitation is that if you want to switch to another Java environment, you will most likely have to restart the current R session and set the JAVA_HOME and PATH environment variables to the desired Java environment using `rJavaEnv::java_env_set()`. This cannot be done dynamically within the same R session due to the way Java is initialized in R, particularly with the `rJava`-dependent packages such as [`r5r`](https://github.com/ipeaGIT/r5r){target="_blank"}. With packages like [`opentripplanner`](https://github.com/ropensci/opentripplanner){target="_blank"}, that performs Java calls using command line, you can switch Java environments dynamically within the same R session as much as you want.
The main limitation is that if you want to switch to another `Java` environment, you will most likely have to restart the current R session and set the `JAVA_HOME` and `PATH` environment variables to the desired `Java` environment using `rJavaEnv::java_env_set()`. This cannot be done dynamically within the same R session due to the way Java is initialized in R, particularly with the `rJava`-dependent packages such as [`r5r`](https://github.com/ipeaGIT/r5r){target="_blank"}. With packages like [`opentripplanner`](https://github.com/ropensci/opentripplanner){target="_blank"}, that performs `Java` calls using command line, you can switch `Java` environments dynamically within the same R session as much as you want.

Therefore, if you need to use R packages that depend on different Java versions within the same project, you will have to create separate R scripts for each Java environment and run them in separate R sessions. One effective way of doing this is to use the [`callr`](https://github.com/r-lib/callr){target="_blank"} package to run R scripts in separate R sessions. Another option is to use the [`targets`](https://github.com/ropensci/targets){target="_blank"} package to manage the whole project workflow, which, as a side effect, will lead to all R scripts being run in separate R sessions. To use `rJavaEnv` with `targets`, you will need to download and install several Java environments using `rJavaEnv::java_download()` and `rJavaEnv::java_install()` and set the relevant path with `rJavaEnv::java_env_set()` at the beginning of each function that requires a certain Java version.
Therefore, if you need to use R packages that depend on different `Java` versions within the same project, you will have to create separate R scripts for each `Java` environment and run them in separate R sessions. One effective way of doing this is to use the [`callr`](https://github.com/r-lib/callr){target="_blank"} package to run R scripts in separate R sessions. Another option is to use the [`targets`](https://github.com/ropensci/targets){target="_blank"} package to manage the whole project workflow, which, as a side effect, will lead to all R scripts being run in separate R sessions. To use `rJavaEnv` with `targets`, you will need to download and install several Java environments using `rJavaEnv::java_download()` and `rJavaEnv::java_install()` and set the relevant path with `rJavaEnv::java_env_set()` at the beginning of each function that requires a certain `Java` version.

## Future work

The future work includes:

- Add support for more Java distributions and versions
- Add support for more `Java` distributions and versions

- Take care of [`R CMD javareconf`](https://solutions.posit.co/envs-pkgs/using-rjava/#reconfigure-r){target="_blank"}

- Possibly add support for specifying Java version beyond the major version
- Possibly add support for specifying `Java` version beyond the major version

- Possibly allow downloading several Java distributions in one function call, e.g. different major versions of the same 'flavour' or different 'flavours' of the same major version
- Possibly allow downloading several `Java` distributions in one function call, e.g. different major versions of the same 'flavour' or different 'flavours' of the same major version

- Possibly add automation to get the Java that is required by specific Java-dependent R packages
- Possibly add automation to get the `Java` that is required by specific `Java`-dependent R packages

I am open to suggestions and contributions, welcome to [issues](https://github.com/e-kotov/rJavaEnv/issues){target="_blank"} and [pull requests](https://github.com/e-kotov/rJavaEnv/pulls){target="_blank"}.

Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "rJavaEnv",
"description": "The 'rJavaEnv' package addresses common issues with 'Java' environment management in 'R' for users of 'Java'/'rJava'-dependent 'R' packages such as 'r5r', 'opentripplanner', 'xlsx', 'openNLP', 'rWeka', 'RJDBC', 'tabulapdf', and many more. It resolves 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 Development Kit' ('JDK') 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 systemm, and who prefer package installation from source, rather then installing binaries from 'Posit Package Manager'. See documentation for details.",
"description": "The 'rJavaEnv' package addresses common issues with 'Java' environment management in 'R' for users of 'Java'/'rJava'-dependent 'R' packages such as 'r5r', 'opentripplanner', 'xlsx', 'openNLP', 'rWeka', 'RJDBC', 'tabulapdf', and many more. It resolves 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 Development Kit' ('JDK') 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.",
"name": "rJavaEnv: 'Java' Environments for R Projects",
"relatedLink": "https://www.ekotov.pro/rJavaEnv/",
"codeRepository": "https://github.com/e-kotov/rJavaEnv",
Expand Down Expand Up @@ -146,7 +146,7 @@
},
"SystemRequirements": null
},
"fileSize": "383.356KB",
"fileSize": "383.35KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
Loading

0 comments on commit 79fd94b

Please sign in to comment.