After upgrading to MacOS Mojave (10.14.1), I\'m no longer able to install rJava
for R version 3.5.1 with Java version \"1.8.0_102\" installed.
I tried
I ran into same issue, when i was trying to install "rJava" in my macOs (Mojave version).
Below steps i executed to resolve issue.
R version : 3.6.1
issue : configure: error: one or more Java tools are missing. *** JDK is incomplete! Please make sure you have a complete JDK. JRE is not sufficient.
solution : execute below command in your terminal
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
1.8.0_162, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk(your Java version)/Contents/Home
$ export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_221.jdk/Contents/Home
$ export PATH=$JAVA_HOME/bin:$PATH
$ R CMD javareconf
$ R --quiet -e 'install.packages("rJava", type="source", repos="http://cran.us.r-project.org")'
After installing JDK 11.04 LTS I rain into the same error in R Studio on Mojave
R was expecting Library not loaded: /Library/Java/JavaVirtualMachines/jdk-11.0.1.jdk
Despite running sudo R CMD javareconf
the error still persisted
Therefore I browsed to /Library/Java/JavaVirtualMachines/
in finder and renamed the folder "jdk-11.0.4.jdk"
to "jdk-11.0.1.jdk"
Restarted R and both library(rJava)
and library(xlsx)
now work.
Hope this helps someone
Posting the solution I found in case it helps others -- I don't quite understand why this work or if it's the right way so looking for better alternatives!
This issue lead to this Apple forum where it's stated
For legacy software that looks for the macOS headers in the base system under /usr/include, please install the package file located at: /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14. pkg
To do this, open terminal and run these commands
cd /Library/Developer/CommandLineTools/Packages/
open macOS_SDK_headers_for_macOS_10.14.pkg
then follow prompts to install the package.
After this, in the terminal, configure rJava and install as in the previous answer
sudo R CMD javareconf
R -e "install.packages('rJava')"
and it should install without problem.
I ran into the exact problem. I solved it by:
Install the latest version of Java (dmg file)
Install rJava in Studio: install.packages("rJava")
sudo mv jdk-12.0.1.jdk jdk-11.0.1.jdk
Otherwise the following error will appear in Rstudio:
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.5/Resources/library/rJava/libs/rJava.so':
dlopen(/Library/Frameworks/R.framework/Versions/3.5/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.5/Resources/library/rJava/libs/rJava.so
Reason: image not found
In Rstudio: library(rJava)
rJava should have been loaded without issues.