[R] can't get rJava to install on Linux

Godmar Back godmar at gmail.com
Wed Jul 8 04:16:45 CEST 2009


On Tue, Jul 7, 2009 at 10:07 PM, Mark Kimpel<mwkimpel at gmail.com> wrote:
> Switching to Sun definitely did not help, still no build with rJava,
> below is the output of  R CMD javareconf.

You didn't switch. The paths /usr/lib/gcj-4.3.-90 etc. - any path
containing 'gcj' - indicates you're using GNU's Java.

It seems this software needs javah and other programs that are part of
the JDK, a superset of the JRE. Make sure you installed the JDK, not
just the JRE.

Let's say you have Sun's JDK installed in /usr/lib/jvm/java-6-sun
(which may or may not be true, you should check!).

Then run with

env JAVA_HOME=/usr/lib/jvm/java-6-sun ./R CMD javareconf

This will set the env variable 'JAVA_HOME' to that directory for the
duration of the invocation of "./R"

On my Ubuntu box, I can verify that I'm using Sun's Java by doing, for instance,

$ javah -version
javah version "1.6.0_07"

Similarly:

$ which javah
/usr/bin/javah
$ ls -l /usr/bin/javah
lrwxrwxrwx 1 root root 23 Oct 17  2008 /usr/bin/javah -> /etc/alternatives/javah
$ ls -l /etc/alternatives/javah
lrwxrwxrwx 1 root root 33 Oct 17  2008 /etc/alternatives/javah ->
/usr/lib/jvm/java-6-sun/bin/javah

So I'm definitely picking up Sun's.
Try running these cmds on your machine.

 - Godmar

>
> mkimpel-m90 /home/mkimpel/bin# ./R CMD javareconf
> *** JAVA_HOME is not a valid path, ignoring
> Java interpreter : /usr/bin/java
> Java version     : 1.6.0_14
> Java home path   : /usr/lib/jvm/java-6-sun-1.6.0.14/jre
> /home/mkimpel/R_HOME/R-2.9.1/R-build/lib64/R/bin/javareconf: line 150:
> /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javac: No such file
> or directory
> Java compiler    : not functional
> Java headers gen.: /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javah
> Java archive tool: /usr/bin/jar
> Java library path: /usr/lib/../lib/gcj-4.3-90:/usr/lib/jni
> JNI linker flags : -L/usr/lib/../lib/gcj-4.3-90 -L/usr/lib/jni -ljvm
> JNI cpp flags    :
>
> Updating Java configuration in /home/mkimpel/R_HOME/R-2.9.1/R-build/lib64/R
> Done.
>
> ------------------------------------------------------------
> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> Indiana University School of Medicine
>
> 15032 Hunter Court, Westfield, IN  46074
>
> (317) 490-5129 Work, & Mobile & VoiceMail
>
> "The real problem is not whether machines think but whether men do."
> -- B. F. Skinner
> ******************************************************************
>
>
>
> On Tue, Jul 7, 2009 at 9:43 PM, Godmar Back<godmar at gmail.com> wrote:
>> This is just a guess: looks like you have GNU's Java version in your
>> path (aka "gcj").
>> Perhaps rJava relies on Sun's Java version.
>>
>> If so, install Sun's Java first. apt-get install sun-java6-jdk might do it.
>>
>>  - Godmar
>>
>>
>> On Tue, Jul 7, 2009 at 9:28 PM, Mark Kimpel<mwkimpel at gmail.com> wrote:
>>> Having difficulties getting rJava to install on my Debian Squeeze box.
>>> Perused the R-help list and tried some things that have worked for
>>> others but not for me. Below is the output of my attempted build, R
>>> CMD javareconf -e, and sessionInfo(). Note I tried the R CMD
>>> javareconf also as root, restarted R after each of these, all no help.
>>>
>>>
>>> * Installing *source* package ‘rJava’ ...
>>> checking for gcc... gcc -std=gnu99
>>> checking for C compiler default output file name... a.out
>>> checking whether the C compiler works... yes
>>> checking whether we are cross compiling... no
>>> checking for suffix of executables...
>>> checking for suffix of object files... o
>>> checking whether we are using the GNU C compiler... yes
>>> checking whether gcc -std=gnu99 accepts -g... yes
>>> checking for gcc -std=gnu99 option to accept ISO C89... none needed
>>> checking how to run the C preprocessor... gcc -std=gnu99 -E
>>> checking for grep that handles long lines and -e... /bin/grep
>>> checking for egrep... /bin/grep -E
>>> checking for ANSI C header files... yes
>>> checking for sys/wait.h that is POSIX.1 compatible... yes
>>> checking for sys/types.h... yes
>>> checking for sys/stat.h... yes
>>> checking for stdlib.h... yes
>>> checking for string.h... yes
>>> checking for memory.h... yes
>>> checking for strings.h... yes
>>> checking for inttypes.h... yes
>>> checking for stdint.h... yes
>>> checking for unistd.h... yes
>>> checking for string.h... (cached) yes
>>> checking sys/time.h usability... yes
>>> checking sys/time.h presence... yes
>>> checking for sys/time.h... yes
>>> checking for unistd.h... (cached) yes
>>> checking for an ANSI C-conforming const... yes
>>> checking whether time.h and sys/time.h may both be included... yes
>>> configure: checking whether gcc -std=gnu99 supports static inline...
>>> yes
>>> checking Java support in R... present:
>>> interpreter : '/usr/bin/java'
>>> archiver    : '/usr/bin/jar'
>>> compiler    : '/usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javac'
>>> header prep.: '/usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javah'
>>> cpp flags   : ''
>>> java libs   : '-L/usr/lib/../lib/gcj-4.3-90 -L/usr/lib/jni -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 ‘/home/mkimpel/R_HOME/site-library-2.9.0/rJava’
>>>
>>> The downloaded packages are in
>>>        ‘/tmp/Rtmpfp9kiG/downloaded_packages’
>>> Warning message:
>>> In install.packages("rJava") :
>>>  installation of package 'rJava' had non-zero exit status
>>>
>>>  ./R CMD javareconf -e
>>> Java interpreter : /usr/bin/java
>>> Java version     : 1.5.0
>>> Java home path   : /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre
>>> Java compiler    : /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javac
>>> Java headers gen.: /usr/lib/jvm/java-1.5.0-gcj-4.3-1.5.0.0/jre/../bin/javah
>>> Java archive tool: /usr/bin/jar
>>> Java library path: /usr/lib/../lib/gcj-4.3-90:/usr/lib/jni
>>> JNI linker flags : -L/usr/lib/../lib/gcj-4.3-90 -L/usr/lib/jni -ljvm
>>> JNI cpp flags    :
>>>
>>> The following Java variables have been exported:
>>> JAVA_HOME JAVA JAVAC JAVAH JAR JAVA_LIBS JAVA_CPPFLAGS JAVA_LD_LIBRARY_PATH
>>>
>>>> sessionInfo()
>>> R version 2.9.1 (2009-06-26)
>>> x86_64-unknown-linux-gnu
>>>
>>> locale:
>>> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=C;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices datasets  utils     methods   base
>>>
>>> loaded via a namespace (and not attached):
>>> [1] tcltk_2.9.1 tools_2.9.1
>>> ------------------------------------------------------------
>>> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
>>> Indiana University School of Medicine
>>>
>>> 15032 Hunter Court, Westfield, IN  46074
>>>
>>> (317) 490-5129 Work, & Mobile & VoiceMail
>>>
>>> "The real problem is not whether machines think but whether men do."
>>> -- B. F. Skinner
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>




More information about the R-help mailing list