[R] installing rJava

Yihui Xie xie at yihui.name
Wed Jul 31 07:13:48 CEST 2013


You can install it from Michael Rutter's PPA:

sudo apt-add-repository -y ppa:marutter/c2d4u
sudo apt-get update
sudo apt-get install r-cran-rjava

The last time I tried the official Ubuntu repository, rJava still did
not work under R 3.0.x (because R 3.0.x requires recompiling all R
packages). I'm not sure if that has changed or not. Michael's
repository has been working well for me (including many other R
packages that have system dependencies).

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 206-667-4385 Web: http://yihui.name
Fred Hutchinson Cancer Research Center, Seattle


On Tue, Jul 30, 2013 at 9:28 PM, Erin Hodgess <erinm.hodgess at gmail.com> wrote:
> Dear R People:
>
> I am trying to install rJava on an Ubuntu 13.04 64 bit system.  But the
> Java part is causing me fits.  Here is the code:
>
>> install.packages("rJava",depen=TRUE)
> Installing package into ‘/home/erin/R/x86_64-pc-linux-gnu-library/3.0’
> (as ‘lib’ is unspecified)
> --- Please select a CRAN mirror for use in this session ---
> trying URL 'http://cran.at.r-project.org/src/contrib/rJava_0.9-4.tar.gz'
> Content type 'application/x-gzip' length 498108 bytes (486 Kb)
> opened URL
> ==================================================
> downloaded 486 Kb
>
> * installing *source* package ‘rJava’ ...
> ** package ‘rJava’ successfully unpacked and MD5 sums checked
> 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 whether setjmp.h is POSIX.1 compatible... yes
> checking whether sigsetjmp is declared... yes
> checking whether siglongjmp is declared... yes
> checking Java support in R... present:
> interpreter : '/usr/lib/jvm/jdk1.7.0_25/jre/bin/java'
> archiver    : '/usr/lib/jvm/jdk1.7.0_25/bin/jar'
> compiler    : '/usr/lib/jvm/jdk1.7.0_25/bin/javac'
> header prep.: '/usr/lib/jvm/jdk1.7.0_25/bin/javah'
> cpp flags   : ''
> java libs   : ''
> 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/erin/R/x86_64-pc-linux-gnu-library/3.0/rJava’
>
> The downloaded source packages are in
>     ‘/tmp/RtmpSzdy7i/downloaded_packages’
> Warning message:
> In install.packages("rJava", depen = TRUE) :
>   installation of package ‘rJava’ had non-zero exit status
>> sessionInfo()
> R version 3.0.1 (2013-05-16)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=C                 LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tcltk_3.0.1 tools_3.0.1
>> q()
> Save workspace image? [y/n/c]: y
>
> Now here is the command line:
>
> erin at erin-Lenovo-IdeaPad-Y480:~$ sudo R CMD javareconf
> Java interpreter : /usr/bin/java
> Java version     : 1.7.0_25
> Java home path   : /usr/lib/jvm/jdk1.7.0_25/jre
> Java compiler    : /usr/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
>
> trying to compile and link a JNI progam
> detected JNI cpp flags    : -I$(JAVA_HOME)/../include
> -I$(JAVA_HOME)/../include/linux
> detected JNI linker flags : -L$(JAVA_HOME)/lib/i386/client -ljvm
> gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG
> -I/usr/lib/jvm/jdk1.7.0_25/jre/../include
> -I/usr/lib/jvm/jdk1.7.0_25/jre/../include/linux     -fpic  -O2 -pipe -g  -c
> conftest.c -o conftest.o
> gcc -std=gnu99 -shared -o conftest.so conftest.o
> -L/usr/lib/jvm/jdk1.7.0_25/jre/lib/i386/client -ljvm -L/usr/lib/R/lib -lR
> /usr/bin/ld: skipping incompatible
> /usr/lib/jvm/jdk1.7.0_25/jre/lib/i386/client/libjvm.so when searching for
> -ljvm
> /usr/bin/ld: cannot find -ljvm
> collect2: error: ld returned 1 exit status
> make: *** [conftest.so] Error 1
> Unable to compile a JNI program
>
>
> Java library path:
> JNI cpp flags    :
> JNI linker flags :
> Updating Java configuration in /usr/lib/R
> Done.
>
> erin at erin-Lenovo-IdeaPad-Y480:~$
>
> I'm thinking that there is a problem with shared/static libraries,
> perhaps?
>
>
> Has anyone else run into this, please?  Any help much appreciated.
>
> Sincerely,
> Erin
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess at gmail.com



More information about the R-help mailing list