web-dev-qa-db-ja.com

UbuntuへのrJavaのインストールに失敗しました

「Sudo R CMD javareconf」に続いてRの「install.packages( 'rJava'、type = "source")」でrJavaパッケージをインストールしようとしましたが、機能しません。

最初に、Javaをこの方法でインストールしました

Sudo add-apt-repository ppa:webupd8team/Java
Sudo apt-get update
Sudo apt-get install Oracle-Java8-installer

私の.bashrcでは、

export Java_HOME=/usr/lib/jvm/Java-8-Oracle
export PATH=$PATH:$Java_HOME/bin

それから

     Sudo R CMD javareconf 
*** Java_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/Java
Java version     : 1.8.0_111
Java home path   : /usr/lib/jvm/Java-8-Oracle/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 program 
detected JNI cpp flags    : -I$(Java_HOME)/../include -I$(Java_HOME)/../include/linux
detected JNI linker flags : -L$(Java_HOME)/lib/AMD64/server -ljvm
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/lib/jvm/Java-8-Oracle/jre/../include -I/usr/lib/jvm/Java-8-Oracle/jre/../include/linux     -fpic  -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g  -c conftest.c -o conftest.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o conftest.so conftest.o -L/usr/lib/jvm/Java-8-Oracle/jre/lib/AMD64/server -ljvm -L/usr/lib/R/lib -lR


Java_HOME        : /usr/lib/jvm/Java-8-Oracle/jre
Java library path: $(Java_HOME)/lib/AMD64/server
JNI cpp flags    : -I$(Java_HOME)/../include -I$(Java_HOME)/../include/linux
JNI linker flags : -L$(Java_HOME)/lib/AMD64/server -ljvm
Updating Java configuration in /usr/lib/R
Done.

それから

    Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/sunxd/R/x86_64-pc-linux-gnu-library/3.3/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/sunxd/R/x86_64-pc-linux-gnu-library/3.3/rJava’

The downloaded source packages are in
    ‘/tmp/RtmpxpdHF7/downloaded_packages’
Warning message:
In install.packages("rJava", type = "source") :
  installation of package ‘rJava’ had non-zero exit status
6
sunxd

ターミナルからr-cran-rjavaをインストールするだけで開始できます

$ Sudo apt-get install r-cran-rjava

次に、Rからこれを実行します

install.packages('rJava')
5
Amine Jallouli