[R] help updating package rJava (on ubuntu)

Karl Brand k.brand at erasmusmc.nl
Sun Feb 19 22:31:49 CET 2012


Hi Hasan,

Success. For myself and FWIW to other useR's here's how i spent the 
sunny half of my sunday to achieve it :/

Many thanks for your and Simon's input,

Karl

Since:

$ javac -version

returned nothing i believe you (and Simon) were right, i.e, it (and JDK) 
were missing on my system. Furthermore:

$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version     : 1.6.0_23
Java home path   : /usr/lib/jvm/java-6-openjdk/jre
Java compiler    : not present
Java headers gen.:
Java archive tool:
Java library path: 
$(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server 
-L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 
-L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags    :

Updating Java configuration in /etc/R
Done.

Some things are clearly absent i.e.,
Java compiler    : not present
Java headers gen.:
Java archive tool:

Now i have:

$ javac -version
javac 1.6.0_23

$ sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version     : 1.6.0_23
Java home path   : /usr/lib/jvm/java-6-openjdk/jre
Java compiler    : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path: 
$(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/amd64:$(JAVA_HOME)/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server 
-L$(JAVA_HOME)/lib/amd64 -L$(JAVA_HOME)/../lib/amd64 
-L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags    : -I$(JAVA_HOME)/../include

Updating Java configuration in /etc/R
Done.

Certainly i don't know exactly what was needed to achieve this. BUT - 
for posterities sake, this is what i did:

## purge and reinstall openjdk-6-jdk which turned outwasn't installed!
## how this can be when i have a /usr/lib/jvm/java-6-openjdk full of
## files i don't understand. Moreover since i had the previosu version
## of rJava running fine!!!
$ sudo apt-get purge openjdk-6-jdk
<snip>
Package openjdk-6-jdk is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

## install openjdk-6-jdk
$ sudo apt-get install openjdk-6-jdk

## Per- http://ubuntuforums.org/showthread.php?t=1491846
## added 2 entries to /etc/bash.bashrc file
$ gksudo gedit /etc/bash.bashrc

## entries were:
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre
export PATH=$PATH:$JAVA_HOME/bin

## note the addition of /jre for JAVA_HOME per-
## 
http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing

<saved bash.bashrc file then reloaded>

$ source /etc/bash.bashrc

## confirmed
$ echo $JAVA_HOME
/usr/lib/jvm/java-6-openjdk/jre

## configured java
$ sudo R CMD javareconf

I was then able to update rJava in a new R-session.

Also note that per- 
http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing

$ apt-get install r-cran-rjava

did NOT enable me to update my rJava. Unless i buggered up something 
else along the way :/




On 02/18/2012 10:20 PM, Hasan Diwan wrote:
> On 18 February 2012 13:13, Karl Brand<k.brand at erasmusmc.nl>  wrote:
>> Thanks for yout fast response. Thing is - i managed to get Version 0.9-1
>> installed and fully functional. And
>>
>> $ locate jdk
>> returns too many entries to post here, so i'm pretty sure its on the
>> machine.
>
>
> What you want to look for is javac, not jdk. On my ubuntu system, this
> is to be found at /usr/lib/jvm/java-6-openjdk-i386/bin/javac
>>
>> So i'd like to know how i can ensure it's "registered in R". This i have no
>> idea how to do. I simply don't have enough R and linux experience. Also the
>> thread i mentioned
>> http://stackoverflow.com/questions/3311940/r-rjava-package-install-failing
>> seems to be about pointing R at the right location of certain aspects of
>> Java. But lacks enough explicit details for myself to be able use.
>
> A previous response indicated R javareconf -- this is the only
> configuration you should need. Let me know if you have further
> problems.

-- 
Karl Brand
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
T +31 (0)10 704 3455 |F +31 (0)10 704 4743 |M +31 (0)642 777 268



More information about the R-help mailing list