Reputation: 719
I am trying to load 'rJava' package in my Unix machine. Before loading I have set the path using
Sys.setenv("JAVA_HOME= myfilepath")
in my R script.
Despite this I am getting the following error (Below is the part of the error):
checking Java support in R... present:
interpreter : '/usr/lib/jvm/jre/bin/java'
archiver : '/usr/lib/jvm/jre/../bin/jar'
compiler : '/usr/lib/jvm/jre/../bin/javac'
header prep.: '/usr/lib/jvm/jre/../bin/javah'
cpp flags : '-I/usr/lib/jvm/java/include I/usr/lib/jvm/java/include/linux'
java libs : '-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm'
checking whether Java run-time works... ./configure: line 3729: /usr/lib/jvm/jre/bin/java: No such file or directory
no configure: error: Java interpreter '/usr/lib/jvm/jre/bin/java' does not work
As you can see the error shows that /usr/lib/jvm/jre/bin/java: No such file or directory. But I have not set this as myfilepath. How do I prevent the installer from looking at this path?
Kindly help.
Upvotes: 30
Views: 20485
Reputation: 1527
sudo R CMD javareconf
This works perfectly. Keeping this here if someone reads this in future.
Upvotes: 81
Reputation: 97
I have a VM of Ubuntu 14.04 LTS on VirtualBox, and the real path of installation of my java-jdk is the following :
/usr/lib/jvm/java-7-openjdk-amd64
This command worked very fine for my situation. I had this type of error from installation o rJava package on RStudio:
*./configure: line 3736: /usr/lib/jvm/default-java/jre/bin/java: No such file or directory*
First I' have modified the profile in this way : sudo gedit /etc/profile and then added this instructions at the eof:
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
After this, from terminal session I've typed the command:
sudo R CMD javareconf
and the package rJava was successfully installed.
Note: You might also have to set the LD_LIBRARY_PATH
environment variable, before running sudo R CMD javareconf
.
Upvotes: 3
Reputation: 578
Faced same problem in Ubuntu 14.04. This installation guide was helpful for me after going through a straightforward installation. http://www.korecky.org/?p=1254 (Installation of R) and [http://www.korecky.org/?p=847] (Installation of Java)
Upvotes: 0