31

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.

4
  • 1
    Take a look here maybe. There are some good tips there. Commented Jun 1, 2015 at 11:33
  • I had check that post before posting the question. I tried everything there. Does not seem to work for me. Commented Jun 1, 2015 at 11:56
  • 12
    Did you tried sudo R CMD javareconf I had the same problem. rJava trying to check the directories which is not at all there in my system. But after running the above config command, it worked for me. Commented Jul 29, 2015 at 2:06
  • thanks Manoj sudo R CMD javareconf worked for me. Commented Sep 29, 2015 at 3:24

3 Answers 3

81
sudo R CMD javareconf

This works perfectly. Keeping this here if someone reads this in future.

Sign up to request clarification or add additional context in comments.

6 Comments

This didn't have any effect for me (Mint 18).
@Deleet Worked for me (Ubuntu Server 16.04) , after I installed openjdk-7-jdk
Worked for me, ubuntu 16.04.2!
For this to work you need to have java installed first. See here for instructions: stackoverflow.com/questions/14788345/…
After sudo R CMD javareconf, run sudo rstudio-server restart.
|
3

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.

Comments

0

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)

1 Comment

Links to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.