R 3.6.3
OSX and Windows

Colleagues

I want to identify if Java is installed on a particular computer.

When I execute
        Java -version
in a terminal (OSX), but not in R, there are two outcomes:
        
Java installed yields:
        java version "13.0.1" 2019-10-15 
        Java(TM) SE Runtime Environment (build 13.0.1+9) 
        Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing) 

Java not installed yields:
        No Java runtime installed

I assume that there are comparable outputs in Windows.

I would like to capture this output in R using the system command, then search 
for “No Java runtime installed” )or the correponding text in Windows).

I execute something like:
        CAPTURE <- system("Java -version", intern=TRUE, ignore.stderr=FALSE, 
ignore.stdout=FALSE)       
(with various permutations of TRUE/FALSE for the options) but I cannot capture 
what is displayed on the console.

I have also tried “system2” with various TRUE/FALSE permutations without 
success.

Any clever ideas?

Dennis

Dennis Fisher MD
P < (The "P Less Than" Company)
Phone / Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to