web-dev-qa-db-ja.com

UbuntuシステムにrJavaをインストールできません

私はこれに関連するいくつかの投稿を見ました...しかし、私が見たすべての提案された解決策は機能しないようです...私はEC2インスタンスでRを実行していて、次のコマンドを実行してrJavaをインストールしようとしましたが、うまくいきませんでした...助けていただければ幸いです。

 > install.packages("rJava")
 Installing package(s) into ‘/home/ubuntu/R/library’
 (as ‘lib’ is unspecified)
 trying URL 'http://cran.stat.nus.edu.sg/src/contrib/rJava_0.9-3.tar.gz'
 Content type 'application/x-gzip' length 537153 bytes (524 Kb)
 opened URL
 ==================================================
 downloaded 524 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/bin/Java'
archiver    : ''
compiler    : ''
header prep.: ''
cpp flags   : ''
Java libs   : '-L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/lib/AMD64/server -L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/lib/AMD64 -L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/../lib/AMD64 -L/usr/Java/packages/lib/AMD64 -L/usr/lib/x86_64-linux-gnu/jni -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/jni -L/lib -L/usr/lib -ljvm'
configure: error: Java Development Kit (JDK) is missing or not registered in R
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/ubuntu/R/library/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpaEiskU/downloaded_packages’
> system("Sudo R CMD javareconf")
Java interpreter : /usr/bin/Java
Java version     : 1.6.0_24
Java home path   : /usr/lib/jvm/Java-6-openjdk-AMD64/jre
Java compiler    : not present
Java headers gen.: 
Java archive tool: 
Java library path: $(Java_HOME)/lib/AMD64/server:$(Java_HOME)/lib/AMD64:$(Java_HOME)/../lib/AMD64:/usr/Java/packages/lib/AMD64:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib
JNI linker flags : -L$(Java_HOME)/lib/AMD64/server -L$(Java_HOME)/lib/AMD64 -L$(Java_HOME)/../lib/AMD64 -L/usr/Java/packages/lib/AMD64 -L/usr/lib/x86_64-linux-gnu/jni -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/jni -L/lib -L/usr/lib -ljvm
JNI cpp flags    : 

Updating Java configuration in /etc/R
Done.

> install.packages("rJava")
[same as before, just skipping to the error parts...]
 Java libs   : '-L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/lib/AMD64/server -L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/lib/AMD64 -L/usr/lib/jvm/Java-6-openjdk-AMD64/jre/../lib/AMD64 -L/usr/Java/packages/lib/AMD64 -L/usr/lib/x86_64-linux-gnu/jni -L/lib/x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -L/usr/lib/jni -L/lib -L/usr/lib -ljvm'
configure: error: Java Development Kit (JDK) is missing or not registered in R
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/ubuntu/R/library/rJava’
Warning in install.packages :
  installation of package ‘rJava’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpaEiskU/downloaded_packages’
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C            LC_COLLATE=C        
 [5] LC_MONETARY=C        LC_MESSAGES=C        LC_PAPER=C           LC_NAME=C           
 [9] LC_ADDRESS=C         LC_TELEPHONE=C       LC_MEASUREMENT=C     LC_IDENTIFICATION=C 

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.15.1
25
h.l.m

UbuntuでrJavaを入手する最も簡単な方法は、CRANから直接インストールするのではなく、リポジトリからインストールすることです。コマンドラインからこれはトリックを行う必要があります

Sudo apt-get install r-cran-rjava
53
Dason

現在同じ問題に直面していますが、解決策が機能しなくなったようです。ランニング

Sudo apt-get install r-cran-rjava

くれます

The following packages have unmet dependencies:
 r-cran-rjava : Depends: r-api-3.4

Linux Mint Tessa 19.1を使用していて、Rバージョン3.6.1を使用しています(2019-07-05)

1
Ju Ko

持っていた

The following packages have unmet dependencies:
 r-cran-rjava : Depends: r-api-3.4

私は解決しました

Sudo apt-get update
Sudo apt-get install default-jre
Sudo apt-get install default-jdk

そして

Sudo apt-get install r-cran-rjava
0