Skip to content

Commit 3aaa639

Browse files
committed
suggests rJavaEnv
1 parent 6854c58 commit 3aaa639

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,17 @@ You can install `r5r`:
4040

4141
Please bear in mind that you need to have *Java Development Kit (JDK) 21* installed on your computer to use `r5r`. No worries, you don't have to pay for it. There are numerous open-source JDK implementations, any of which should work with `r5r`. If you don't already have a preferred JDK, we recommend [Adoptium/Eclipse Temurin](https://adoptium.net/). Other open-source JDK implementations include [Amazon Corretto](https://aws.amazon.com/corretto/), and [Oracle OpenJDK](https://jdk.java.net/21/). You only need to install one JDK.
4242

43-
If you don't know what version of Java you have installed on your computer,
44-
can check it by running this on R console.
43+
The easiest way to install JDK is using the new [{rJavaEnv}](https://www.ekotov.pro/rJavaEnv/) package in R:
4544

4645
```R
47-
rJava::.jinit()
48-
rJava::.jcall("java.lang.System", "S", "getProperty", "java.version")
46+
# install.packages('rJavaEnv')
47+
48+
# check version of Java currently installed (if any)
49+
rJavaEnv::java_check_version_rjava()
50+
51+
# install Java 21
52+
rJavaEnv::java_quick_install(version = 21)
53+
4954
```
5055

5156
## Usage

r-package/DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Suggests:
6161
knitr,
6262
parallel,
6363
patchwork,
64+
rJavaEnv,
6465
rmarkdown,
6566
testthat
6667
VignetteBuilder:

r-package/vignettes/r5r.Rmd

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,24 @@ numerous open-source JDK implementations, and you only need to install one JDK.
6060
- [Amazon Corretto](https://aws.amazon.com/corretto/)
6161
- [Oracle OpenJDK](https://jdk.java.net/21/).
6262

63+
The easiest way to install JDK is using the new [{rJavaEnv}](https://www.ekotov.pro/rJavaEnv/) package in R:
6364

64-
If you don't know what version of Java you have installed on your computer, you can check it by running this on R console.
6565
```{r, eval = FALSE}
66-
rJava::.jinit()
67-
rJava::.jcall("java.lang.System", "S", "getProperty", "java.version")
66+
# install {rJavaEnv} from CRAN
67+
install.packages("rJavaEnv")
68+
69+
# check version of Java currently installed (if any)
70+
rJavaEnv::java_check_version_rjava()
71+
72+
## if this is the first time you use {rJavaEnv}, you might need to run this code
73+
## below to consent the installation of Java.
74+
# rJavaEnv::rje_consent(provided = TRUE)
75+
76+
# install Java 21
77+
rJavaEnv::java_quick_install(version = 21)
78+
79+
# check if Java was successfully installed
80+
rJavaEnv::java_check_version_rjava()
6881
6982
```
7083

0 commit comments

Comments
 (0)