3

I am trying to install package "xlsx" in RStudio on a mac. It tries to install rJava and I get the following error:

checking whether Java run-time works... No Java runtime present, requesting install.

no configure: error: Java interpreter '/usr/bin/java' does not work ERROR: configuration failed for package ‘rJava’ * removing ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava’ * restoring previous ‘/Library/Frameworks/R.framework/Versions/3.5/Resources/library/rJava’ Warning in install.packages : installation of package ‘rJava’ had non-zero exit status

It prompts me to go download Java and I do. Once it is done installing I try to install package rJava again in RStudio and it give me the exact same error and prompts me to download Java again.

I can see Java in my system preferences but when I go to the terminal and type java -version I get the same prompt to go download Java. It's like my computer just isn't recognizing Java.

Any idea for how I can fix this and get rJava installed?

Thank you!

Rot-man
  • 18,045
  • 12
  • 118
  • 124
ARobl
  • 31
  • 3
  • Take a look here: http://www.owsiak.org/r-java-rjava-and-macos-adventures/ and here: http://www.owsiak.org/r-3-4-rjava-macos-and-even-more-mess/ and my recent update here: https://stackoverflow.com/questions/55056600/cant-load-rjava-on-macos-mojave-and-r-3-5-2/55070095#55070095 – Oo.oO Apr 03 '19 at 16:11

2 Answers2

1

I was having the same issue at linux... From "/usr/bin/java" you are using Linux, presume this is also the case. The required Java installer can be installed as described here in linux terminal

sudo apt-get install default-jre
sudo apt-get install default-jdk

by restarting R installation worked

hamagust
  • 728
  • 2
  • 10
  • 28
0

I had similar problems, and went to use openXLSX which doesn't require Java.