R: rJava package install failing

后端 未结 17 1180
Happy的楠姐
Happy的楠姐 2020-11-22 16:28

When installing rJava using the install.packages(\"rJava\") command I get the following error:

checking Java support in R... present:
interprete         


        
相关标签:
17条回答
  • 2020-11-22 16:48

    What worked for me was changing JAVA_HOME from file /usr/lib/R/etc/javaconf

    I first checked what was my version of Java enabled : sudo update-alternatives --config java. In my case, it was java-8-oracle

    I opened the file /usr/lib/R/etc/javaconf and replaced default-java by java-8-oracle :

    ${JAVA_HOME=/usr/lib/jvm/default-java}
    

    replaced by :

    ${JAVA_HOME=/usr/lib/jvm/java-8-oracle}
    

    And then sudo R CMD javareconf

    I restarted RStudio, and could then install rJava.

    0 讨论(0)
  • 2020-11-22 16:48

    what I do is here:

    1. in /etc/apt/sources.list, add:

      deb http://ftp.de.debian.org/debian sid main

    Note:the rjava should be latest version

    2 run: sudo apt-get update sudo apt-get install r-cran-rjava

    Once update the old version of rjava, then can install rhdfs_1.0.8.

    0 讨论(0)
  • 2020-11-22 16:49

    This worked for me on Ubuntu 12.04 and R version 3.0

    cd /usr/lib/jvm/java-6-sun-1.6.0.26/include
    

    this is the directory that has jni.h

    Next create a soft link to another required header file (I'm too lazy to find out how to include more than one directory in the JAVA_CPPFLAGS option below):

    sudo ln -s linux/jni_md.h .
    

    Finally

    sudo R CMD javareconf JAVA_CPPFLAGS=-I/usr/lib/jvm/java-6-sun-1.6.0.26/include
    
    0 讨论(0)
  • 2020-11-22 16:49

    Running R under Gentoo on an AMD64. I upgraded to R 2.12.0

    R version 2.12.0 (2010-10-15) Copyright (C) 2010 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-pc-linux-gnu (64-bit) and those pesky messages went away.

    Jan Vandermeer

    0 讨论(0)
  • 2020-11-22 16:50

    I tried to install openjdk-7-* but still I had problems installing rJava. Turns out after I restarted my computer, then there was no problem at all.

    so

    sudo apt-get install openjdk-7-*
    
    
    RESTART after installing java, then try to install package "rJava" in R
    
    0 讨论(0)
  • 2020-11-22 16:50

    The rJava package looks for the /usr/lib/jvm/default-java/ folder. But it's not available as default. This folder have a symlink for the default java configured for the system.

    To activate the default java install the following packages:

    sudo apt-get install default-jre default-jre-headless

    Tested on ubuntu 17.04 with CRAN R 3.4.1

    0 讨论(0)
提交回复
热议问题