On Nov 9, 2019, at 9:28 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
I am mystified by your description.
A) If java is not installed, the operating system or system shell will be the source of any error associated with attempting to invoke it. That means the error message could be anything, but I find it quite surprising that the message emitted by the OS would mention "runtime". In any event, look for the output you can rely on from java for positive identification rather than looking for any consistent pattern in the error messages for negative confirmation.
B) Many OS command shells are case-sensitive... asking for the "Java" program is in that case different than asking for the "java" program.
On November 9, 2019 8:51:43 AM PST, Dennis Fisher <fisher at plessthan.com> wrote:
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