[R] Installing R in Linux: problems with JAVA packages (rJava, RWeka, ...) ?

Paulo Cortez pcortez at dsi.uminho.pt
Wed Oct 22 13:00:22 CEST 2008


Thanks for the many answers I received.

This is becoming a nightmare and I am concluding that installing java1.6 
in CentOS5 is particularly hard, specially if you installed previous jdk 
versions...

I tryed a wide range of solutions. I resume some of them:

1) Tryed to reinstall jdk1.6 and use update-alternatives command;
1) The CentOS5 howto java guide is outdated and does not work 
(http://wiki.centos.org/HowTos/JavaOnCentOS);
2) I installed openjdk, from: http://openjdk.java.net/install/
I checked if the java was updated with:
$alternatives --config java

There are 2 programs which provide 'java'.

   Selection    Command
-----------------------------------------------
    1           /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java

Then, after several R CMD javareconf attemps I got:

------
Java interpreter : /usr/bin/java
Java version     : 1.6.0_0
Java home path   : /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../bin/javah
Java archive tool: /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/../bin/jar
Java library path: 
$(JAVA_HOME)/lib/i386/server:$(JAVA_HOME)/lib/i386:$(JAVA_HOME)/../lib/i386::/usr/java/packages/lib/i386:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/i386/server 
-L$(JAVA_HOME)/lib/i386 -L$(JAVA_HOME)/../lib/i386 -L 
-L/usr/java/packages/lib/i386 -L/lib -L/usr/lib -ljvm
JNI cpp flags    : -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux

Updating Java configuration in /usr/lib/R
Done.
------
The link files are ok:
$ ls -la /usr/bin/ja*
lrwxrwxrwx 1 root root  8 Apr 11  2008 /usr/bin/jade -> openjade
lrwxrwxrwx 1 root root 48 Oct 22 10:52 /usr/bin/java -> 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/java
lrwxrwxrwx 1 root root 49 Oct 22 10:52 /usr/bin/javac -> 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javac
lrwxrwxrwx 1 root root 51 Oct 22 11:19 /usr/bin/javadoc -> 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javadoc
lrwxrwxrwx 1 root root 49 Oct 22 11:18 /usr/bin/javah -> 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javah
lrwxrwxrwx 1 root root 50 Oct 22 10:52 /usr/bin/javaws -> 
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/bin/javaws

But then I try:
$ R CMD INSTALL rJava (the rJava.tar.gz was unpacked)
...
checking whether JNI programs can be compiled... configure: error: 
Cannot compile a simple JNI program. See config.log for details.
---------
Opening the config.log file I get:
---------
configure:3880: checking whether JNI programs can be compiled
configure:3898: gcc -o conftest -O3 -g -std=gnu99 
-I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux   conftest.c 
-L$(JAVA_HOME)/lib/i386/server -L$(JAVA_HOME)/l
ib/i386 -L$(JAVA_HOME)/../lib/i386 -L -L/usr/java/packages/lib/i386 
-L/lib -L/usr/lib -ljvm >&5
/usr/bin/ld: cannot find -ljvm
collect2: ld returned 1 exit status
configure:3904: $? = 1
configure: failed program was:
|
| #include <jni.h>
| int main(void) {
|     jobject o;
|     JNI_CreateJavaVM(0, 0, 0);
|     return 0;
| }
|
configure:3920: error: Cannot compile a simple JNI program. See 
config.log for details.

All these attempts took 2 hours of my life, with no results :(((

Regards,
-- 
Paulo Alexandre Ribeiro Cortez  (PhD, MSc)
Lecturer (Prof. Auxiliar) at the Department of Information Systems (DSI)
University of Minho, Campus de AzurÈm, 4800-058 Guimaraes, Portugal
http://www.dsi.uminho.pt/~pcortez +351253510313 Fax:+351253510300



More information about the R-help mailing list