[Rd] status of Java & rJava?

Spencer Graves @pencer@gr@ve@ @end|ng |rom prod@y@e@com
Sun Mar 29 15:03:16 CEST 2020

       I spoke too soon in saying that everything worked with OpenJDK:  
"R CMD check Ecfun_0.2-4.tar.gz" using 
"https://github.com/sbgraves237/Ecfun" worked fine on my Mac but failed 
with "error: DLL 'rJava' not found: maybe not installed for this 
architecture?" under Windows 10.  "00install.out" and 
"Sys.getenv('PATH')" follow.  "library(rJava)" seemed to work, and 
"help(pac='rJava') displays 0.9-12.  Suggestions?  Thanks, Spencer Graves

* installing *source* package 'Ecfun' ...
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
Error: package or namespace load failed for 'Ecfun':
  .onLoad failed in loadNamespace() for 'rJava', details:
   call: library.dynam("rJava", pkgname, libname)
   error: DLL 'rJava' not found: maybe not installed for this architecture?
Error: loading failed
Execution halted
*** arch - x64
ERROR: loading failed for 'i386'
* removing 'C:/Users/spenc/Documents/R/Ecfun/Ecfun.Rcheck/Ecfun'


 > Sys.getenv('PATH')
[1] "C:\\Program Files\\R\\R-3.6.3\\bin\\x64;C:\\Program 
Files\\Microsoft VS Code\\bin;C:\\Program Files\\Git\\cmd;C:\\Program 
Files\\Pandoc\\;C:\\Program Files\\MiKTeX 

On 2020-03-28 23:07, Prof Brian Ripley wrote:
> On 29/03/2020 04:07, Simon Urbanek wrote:
>> Spencer,
>> you could argue that Java is dead since Oracle effectively killed it 
>> by removing all public downloads, but if you manage to get hold of a 
>> Java installation then it works just fine with R. To my best 
>> knowledge there has never been an issue if you installed rJava from 
>> source. macOS Catalina has made binary distributions impossible due 
>> to additional restrictions on run-time, but even that has been how 
>> solved with the release of rJava 0.9-12, so please make sure you use 
>> the latest rJava. In most cases that I have seen issues were caused 
>> by incorrect configuration (setting JAVA_HOME incorrectly [do NOT set 
>> it unless you know what you're doing!], not installing Java for the 
>> same architecture as R etc.). If you have any issues feel free to 
>> report them. rJava 0.9-12 has quite a few changes that try to detect 
>> user errors better and report them so I strongly suggest users to 
>> upgrade.
> There is OpenJDK, and https://adoptopenjdk.net provides binaries for 
> macOS, including the preferred Java 11 LTS.  I just re-checked that, 
> and after
> env 
> JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home 
> R CMD javareconf
> I was able to install from source and check rJava 0.9-12 in 4.0.0 
> alpha.  For the CRAN binary of 3.6.3 I had to make sure I was using 
> clang 7: 'clang' defaults to that in the Apple CLT which does not 
> support -fopenmp -- but the binary package just worked.
> [All on Catalina.]

Thanks.  That worked on Catalina.  When installing OpenJDK on Windows 
10, The default for "Set JAVA_HOME" was 'X';  I changed that to 
install.  It didn't work at first, but did after I rebooted.

Thanks again to both Simon Urbanek and Prof. Ripley.  Spencer Graves

More information about the R-devel mailing list