[R] Identifying presence of Java

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Sun Nov 10 00:20:13 CET 2019


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 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?

I have seen this happen when the Java settings changed from a different
version which can happen.  The common fix is to

   R CMD javareconf

to updated R's settings about Java. (This step also happens when you rebuild
R; but rebuilding R is typically not required; we just want updated Java
settings).

If that is done, and your Java installation is otherwise sufficient then

   R CMD INSTALL rJava_*tar.gz

(or equally from within R)  should do the trick.

Dirk

-- 
http://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-help mailing list