[R] Identifying presence of Java

Dennis Fisher ||@her @end|ng |rom p|e@@th@n@com
Sat Nov 9 19:53:36 CET 2019


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 = DLLpath, ...)
>   error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so':
>   dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so, 6): Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk/Contents/Home/lib/server/libjvm.dylib
>   Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rJava/libs/rJava.so
>   Reason: image not found
> 
Java is definitely installed on this machine — from a terminal:
	PET513> Java -version
	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)

It appears that the problem relates to version # — I have 13.03.1 installed whereas R is looking for 11.0.1

Any idea how to fix this?

Dennis

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




> On Nov 9, 2019, at 9:35 AM, Dirk Eddelbuettel <edd using debian.org> wrote:
> 
> 
> Dennis,
> 
> R does that for you already as it needs to know it for rJava too.
> 
> On my (Linux) box:
> 
>  edd using rob:~$ R CMD config JAVA
>  /usr/lib/jvm/default-java/bin/java
>  edd using rob:~$ R CMD config JAVA_HOME
>  /usr/lib/jvm/default-java
>  edd using rob:~$ 
> 
> You could also do the equivalent of `which` or `type -p` from R:
> 
>  R> Sys.which("javac")
>             javac 
>  "/usr/bin/javac" 
>  R> Sys.which("javacdoesnotexist")
>  javacdoesnotexist 
>               "" 
>  R> 
> 
> Hope this helps, Dirk
> 
> -- 
> http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-help mailing list