Reputation: 5
I am new to developing a package in R and I was wondering if someone can lead me in the right direction?
My problem
I am writing a package in R that calls Scala code. So to develop this package I assume that JDK (Java Development Kit) 1.8 is installed on any machine that uses my package.
I want to know how I can write a function that checks if Java is being installed in the machine. If so, what is its version? If Java is not installed then it prompts a message and notifies the user about the problem.
Upvotes: 0
Views: 218
Reputation: 145965
On my machine:
> x = system2("java", args = "-version", stdout = TRUE)
> x
[1] "java version \"1.8.0_261\""
[2] "Java(TM) SE Runtime Environment (build 1.8.0_261-b12)"
[3] "Java HotSpot(TM) 64-Bit Server VM (build 25.261-b12, mixed mode)"
Upvotes: 1