2
votes
make[1]: Entering directory `/tmp/Rtmpvk6s18/R.INSTALL65f35ee3733f/rJava/jri'
make -C src JRI.jar
make[2]: Entering directory `/tmp/Rtmpvk6s18/R.INSTALL65f35ee3733f/rJava/jri/src'
/usr/bin/javac -target 1.4 -source 1.4 -d . ../Mutex.java ../RBool.java ../RConsoleOutputStream.java ../REXP.java ../RFactor.java ../RList.java ../RMainLoopCallbacks.java ../RVector.java ../Rengine.java ../package-info.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
1 warning

------------ellipsis-----------

rjava.c: In function ‘RJava_request_lock’:
rjava.c:22:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
        ^
rjava.c: In function ‘RJava_clear_lock’:
rjava.c:30:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
        ^
rjava.c: In function ‘RJava_request_callback’:
rjava.c:39:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong) * 3);
        ^
rjava.c: In function ‘RJava_init_ctrl’:
rjava.c:51:8: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   write(ipcout, buf, sizeof(ptrlong));
        ^
rjava.c:52:7: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
   read(resin, buf, sizeof(ptrlong) * 2);
       ^
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o  -shared -L/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server -ljvm -L/usr/lib/R/lib -lR
/usr/bin/javac -target 1.4 -source 1.4 -d . ../Mutex.java ../RBool.java ../RConsoleOutputStream.java ../REXP.java ../RFactor.java ../RList.java ../RMainLoopCallbacks.java ../RVector.java ../Rengine.java ../package-info.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
1 warning
/usr/bin/jar fc JRI.jar org libjri.so
make[2]: Leaving directory `/tmp/Rtmpvk6s18/R.INSTALL65f35ee3733f/rJava/jri/src'
rm -f libjri.so
cp src/libjri.so libjri.so
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
Note: examples/rtest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
/usr/bin/javac -target 1.4 -source 1.4 -classpath src/JRI.jar -d examples examples/rtest2.java
warning: [options] bootstrap class path not set in conjunction with -source 1.4
Note: examples/rtest2.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning
make[1]: Leaving directory `/tmp/Rtmpvk6s18/R.INSTALL65f35ee3733f/rJava/jri'
installing via 'install.libs.R' to /home/ubuntu/R/x86_64-pc-linux-gnu-library/3.0/rJava
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
* DONE (rJava)

----------------------------

My java version is like this

java version "1.7.0_65"
OpenJDK Runtime Environment (IcedTea 2.5.3) (7u71-2.5.3-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

After

install.package("rJava")

I try to import rJava package

library(rJava) Error : .onLoad failed in loadNamespace() for 'rJava', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/home/ubuntu/R/x86_64-pc-linux-gnu-library/3.0/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory Error: package or namespace load failed for ‘rJava’

But I always failed.

I already tried

$ sudo apt-get install r-cran-rjava
$ sudo apt-get install liblzma-dev
$ sudo R CMD javareconf

But It doesn't work. I'm using rStudio on ubuntu server

Linux version 3.13.0-36-generic (buildd@toyol) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) )

How can I solve this problem. Please help me.

3

3 Answers

3
votes

Running this

 sudo apt-get install liblzma-dev

resolved the above problem for me.

The original poster noted that it did not solve the problem for him/her.

3
votes

Following are packages need to be installed on server:

  • libbz2-dev
  • libpcre3-dev or libpcre2-dev
  • liblzma-dev

    sudo apt-get install packagename

0
votes

If you can use Docker for e.g. RStudio, you could use also a prepared Docker image, e.g. https://github.com/SommerEngineering/RStudio cf. Docker Hub: https://hub.docker.com/r/sommereng/rstudio/

This image is prepared for rJava, just call install.packages("rJava") works.

Hope, this help someone.