Re: [R] Identifying presence of Java

2019-11-10 Thread Simon Urbanek
FWIW you cannot assume that java will be on the PATH - especially on Windows it typically is not. That’s why rJava uses registry on Windows to find the Java location. For other platforms there is R CMD config JAVA Cheers, Simon > On Nov 10, 2019, at 3:26 PM, Dennis Fisher wrote: > > Abby >

Re: [R] Identifying presence of Java

2019-11-10 Thread Dennis Fisher
Abby I assume that your OS in Windows — shell is Windows only. Fortunately, it appears that the changing “shell” to “system” works in OS X. So, now I have a solution for both OSs. This issue was a prelude to a larger issue that I will address in a separate email. Thanks to everyone for thei

Re: [R] Identifying presence of Java

2019-11-10 Thread Abby Spurdle
> These seem to work for me: > system("Java -version 2>&1", intern = TRUE) > > system2("Java","-version", stdout = TRUE, stderr = TRUE) > Hi Dennis I tried your example and Duncan's examples. In your example, I get zero. The second of Duncan's examples worked for me, but not the first. I've

Re: [R] Identifying presence of Java

2019-11-09 Thread Dirk Eddelbuettel
Dennis, On 9 November 2019 at 10:53, Dennis Fisher wrote: | Dirk | | I am now more confused (and I appreciate your help in sorting this out). | | I executed | require(“rJava”) | and received the following error: | | > Error: package or namespace load failed for ‘rJava’: | > .onLoad f

Re: [R] Identifying presence of Java

2019-11-09 Thread Rui Barradas
Hello, This error can be a 32 bits vs 64 bits thing. R and java must have the same architecture. If you have 64b Java installed, don't run 32b R. And vice-versa. Hope this helps, Rui Barradas Às 18:53 de 09/11/19, Dennis Fisher escreveu: Dirk I am now more confused (and I appreciate your

Re: [R] Identifying presence of Java

2019-11-09 Thread Abby Spurdle
> (2) Can you run other java commands ("java MyClass", "javac MyClass.java", > etc)? Sorry, I meant to say, can you capture the output from other jdk commands? __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/ma

Re: [R] Identifying presence of Java

2019-11-09 Thread Abby Spurdle
> 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 var

Re: [R] Identifying presence of Java

2019-11-09 Thread Dennis Fisher
Dirk I am now more confused (and I appreciate your help in sorting this out). I executed require(“rJava”) and received the following error: > Error: package or namespace load failed for ‘rJava’: > .onLoad failed in loadNamespace() for 'rJava', details: > call: dyn.load(file, DLLpath

Re: [R] Identifying presence of Java

2019-11-09 Thread Berry, Charles
> On Nov 9, 2019, at 8:51 AM, Dennis Fisher wrote: > > R 3.6.3 > OSX and Windows > > Colleagues > > I want to identify if Java is installed on a particular computer. > [...] > I execute something like: > CAPTURE <- system("Java -version", intern=TRUE, ignore.stderr=FALSE, > ignore.

Re: [R] Identifying presence of Java

2019-11-09 Thread Rui Barradas
Hello, Here are two ways. 1. system2 returns the return value of the shell command so if Java is installed, it should return 0. In the first call it's 'java' (lowercase j), in the second 'Java' (uppercase J). java <- system2('java', '-version') java #[1] 0 Java <- system2('Java', '-version'

Re: [R] Identifying presence of Java

2019-11-09 Thread Duncan Murdoch
On 09/11/2019 12:33 p.m., Dennis Fisher wrote: Jeff A. I can certainly look for the output from Java — but that was not the point — nothing was captured to CAPTURE with either scenarios. B. I tried changing case — that did not solve the problem. The issue remains — when I execute the system

Re: [R] Identifying presence of Java

2019-11-09 Thread Dirk Eddelbuettel
Dennis, R does that for you already as it needs to know it for rJava too. On my (Linux) box: edd@rob:~$ R CMD config JAVA /usr/lib/jvm/default-java/bin/java edd@rob:~$ R CMD config JAVA_HOME /usr/lib/jvm/default-java edd@rob:~$ You could also do the equivalent of `which` or `type -

Re: [R] Identifying presence of Java

2019-11-09 Thread Dennis Fisher
Jeff A. I can certainly look for the output from Java — but that was not the point — nothing was captured to CAPTURE with either scenarios. B. I tried changing case — that did not solve the problem. The issue remains — when I execute the system command, the text output that I presented below

Re: [R] Identifying presence of Java

2019-11-09 Thread Jeff Newmiller
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

[R] Identifying presence of Java

2019-11-09 Thread Dennis Fisher
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 Runti