Skip to content

Can't get R to recognize Java for rJava installation

3 messages · Milan Bouchet-Valat, Waichler, Scott R

#
Hi, I am unable to install the package rJava.  I tried doing what the output suggests, but it doesn't help.  How can I get R to find/recognize my Java installation?  I am running R-2.15.0.

waichler at snow> sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version     : 1.6.0_22
Java home path   : /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
Java compiler    : /usr/bin/javac
Java headers gen.:
Java archive tool: /usr/bin/jar
Java library path: $(JAVA_HOME)/lib/i386/client:$(JAVA_HOME)/lib/i386:$(JAVA_HOME)/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -L$(JAVA_HOME)/lib/i386 -L$(JAVA_HOME)/../lib/i386 -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm
JNI cpp flags    :

Updating Java configuration in /usr/lib/R
Done.
. . . 
checking whether siglongjmp is declared... yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver    : '/usr/bin/jar'
compiler    : '/usr/bin/javac'
header prep.: ''
cpp flags   : ''
java libs   : '-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386/client -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386 -L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../lib/i386 -L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm'
configure: error: One or more Java configuration variables are not set.
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

If you don't have root privileges, run
R CMD javareconf -e
to set all Java-related variables and then install rJava.

ERROR: configuration failed for package ?rJava?
* removing ?/usr/lib/R/library/rJava?

Thanks,
Scott Waichler
Senior Research Scientist
Hydrology Group, Energy & Environment Directorate
Pacific Northwest National Laboratory
#
Le jeudi 12 avril 2012 ? 13:41 -0700, Waichler, Scott R a ?crit :
It looks like you need "Java headers gen." to be set. Here on my box
(Fedora 16) it is:
Java headers gen.: /usr/bin/javah

So I guess you need to find out what package provides this file on your
distribution (which you did not mention). First check the file is
currently not present.


Cheers
#
Milan,

Merci.  I did find the javah file and put it in /usr/bin, where R can now find it.  
However, I still get a similar error message when trying to install rJava, i.e. 

configure: error: One or more Java configuration variables are not set.

The only field that doesn't have a value now are the cpp flags:

cpp flags   : ''

Could this be the problem now?  How can I set those, and what value should I give?

Scott Waichler