Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error of java path on loading rJava package

Tags:

java

unix

r

rjava

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.

like image 565
Aman Mathur Avatar asked Jun 01 '15 11:06

Aman Mathur


People also ask

Do you need Java for rJava?

Prerequisites. The rJava package requires the following. A bit-matching 32-bit or 64-bit version of the Java Runtime Environment (JRE), version 6 or later is installed. The system variable JAVA_HOME is set.

What is rJava?

rJava is a JNI (Java Native Interface)-based, R-to-Java interface with which Java objects may be created and Java methods called and Java fields accessed from R.


1 Answers

sudo R CMD javareconf 

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

like image 128
Sushant Gupta Avatar answered Oct 08 '22 18:10

Sushant Gupta