Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am relatively new to Ubuntu so I wont know a lot of commands that probably became standard to a lot of you guys. I am trying to set up R and with it the necessary java dependencies to install e.g. JGR, rjava, etc. I read through quite a few instructions to do that but somehow I must have done sth wrong. Here is the state of R and java:

R --version

R version 2.14.1 (2011-12-22)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-pc-linux-gnu (64-bit)

java -version

java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.1)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

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: /usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server:/usr/lib/jvm/java-6-openjdk/jre/lib/amd64:/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags    : 

But when I try to install 'JavaGD' in R, which is a dependency for JGR I get:

checking Java support in R... present:
interpreter : '/usr/bin/java'
cpp flags   : ''
java libs   : '-L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64/server -L/usr/lib/jvm/java-6-openjdk/jre/lib/amd64 -L/usr/lib/jvm/java-6-openjdk/jre/../lib/amd64 -L/usr/java/packages/lib/amd64 -L/usr/lib/jni -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.

Any help would be greatly appreciated. Thanks!

share|improve this question

3 Answers 3

up vote 4 down vote accepted

I'm not familiar with R but based on your console it seems like R is requiring a JDK while you have a JRE as you default JAVA home variable. I would suggest you to make sure you have the JDK installed or install it (sudo apt-get install openjdk-6-jdk).
Also make sure that your JAVA_HOME environment variable is pointing to the JDK and not to the JRE (you can see in your output that currently the java home path is set to /usr/lib/jvm/java-6-openjdk/jre.

share|improve this answer
openjdk-6-jdk is installed. When I set the path to /usr/lib/jvm/java-6-openjdk I still get the same error –  Marco K Jan 25 '12 at 7:06
yossile advised the path /usr/lib/jvm/java-6-openjdk/jre –  bodhi.zazen Apr 2 '12 at 3:04

One shouldn't blindly install openjdk-6-jdk. What helped me, was to change the version of Java. Fortunately there is a nice Ubuntu tool for doing that:

sudo update-alternatives --config java

There you can see, what Javas are already available on system, and set the desired one. And then install either openjdk-7-jdk or openjdk-6-jdk (or both)

and only then run

sudo R CMD javareconf

More details about Java choices are on Ubuntu's Community Viki

P.S. For people coming here from Google: Among other things, this post helps solving issues with rj instalation in R, with error message: R is not configured with full Java support. Please make sure an JDK is installed and run R CMD javareconf. When I did that, it said: NOTE: Your JVM has a bogus java.library.path system property!. So: no need messing with Java's library paths!.

share|improve this answer

R CMD javareconf as root

means, you have to use sudo, to issue your command:

sudo R CMD javareconf

You will get asked for your password (your normal userpassword).

share|improve this answer
all the commands above where executed as root user through sudo -su at the start of the session. Sorry, forgot to mention that. –  Marco K Jan 26 '12 at 0:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.