Not able to install rJava in R

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












I am not able to install the rJava package in R.



If I run sudo R CMD javareconf:



*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version : 1.8.0_161
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
g++ -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.


I have also ran the following commands:



export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin


but I don't really know what it is supposed to do...



Finally, it has to be mentioned that



  • if I install and run rJava (using library(rJava)) in sudo mode everything is ok.



  • if I run rJava in normal user mode with



    library(rJava)


    I get the following error:



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



  • If I try to install rJava in normal user mode I get the same error as the previous when testing if package can be loaded:



    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘rJava’:
    .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/home/marc/R/x86_64-pc-linux-
    gnu-library/3.4/rJava/libs/rJava.so':
    libjvm.so: cannot open shared object file: No such file or directory
    Error: loading failed
    Execution halted


Any help would be welcome.







share|improve this question






















  • I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
    – Melebius
    Apr 26 at 10:02















up vote
0
down vote

favorite












I am not able to install the rJava package in R.



If I run sudo R CMD javareconf:



*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version : 1.8.0_161
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
g++ -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.


I have also ran the following commands:



export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin


but I don't really know what it is supposed to do...



Finally, it has to be mentioned that



  • if I install and run rJava (using library(rJava)) in sudo mode everything is ok.



  • if I run rJava in normal user mode with



    library(rJava)


    I get the following error:



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



  • If I try to install rJava in normal user mode I get the same error as the previous when testing if package can be loaded:



    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘rJava’:
    .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/home/marc/R/x86_64-pc-linux-
    gnu-library/3.4/rJava/libs/rJava.so':
    libjvm.so: cannot open shared object file: No such file or directory
    Error: loading failed
    Execution halted


Any help would be welcome.







share|improve this question






















  • I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
    – Melebius
    Apr 26 at 10:02













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am not able to install the rJava package in R.



If I run sudo R CMD javareconf:



*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version : 1.8.0_161
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
g++ -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.


I have also ran the following commands:



export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin


but I don't really know what it is supposed to do...



Finally, it has to be mentioned that



  • if I install and run rJava (using library(rJava)) in sudo mode everything is ok.



  • if I run rJava in normal user mode with



    library(rJava)


    I get the following error:



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



  • If I try to install rJava in normal user mode I get the same error as the previous when testing if package can be loaded:



    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘rJava’:
    .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/home/marc/R/x86_64-pc-linux-
    gnu-library/3.4/rJava/libs/rJava.so':
    libjvm.so: cannot open shared object file: No such file or directory
    Error: loading failed
    Execution halted


Any help would be welcome.







share|improve this question














I am not able to install the rJava package in R.



If I run sudo R CMD javareconf:



*** JAVA_HOME is not a valid path, ignoring
Java interpreter : /usr/bin/java
Java version : 1.8.0_161
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
g++ -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.


I have also ran the following commands:



export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$PATH:$JAVA_HOME/bin


but I don't really know what it is supposed to do...



Finally, it has to be mentioned that



  • if I install and run rJava (using library(rJava)) in sudo mode everything is ok.



  • if I run rJava in normal user mode with



    library(rJava)


    I get the following error:



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



  • If I try to install rJava in normal user mode I get the same error as the previous when testing if package can be loaded:



    ** testing if installed package can be loaded
    Error: package or namespace load failed for ‘rJava’:
    .onLoad failed in loadNamespace() for 'rJava', details:
    call: dyn.load(file, DLLpath = DLLpath, ...)
    error: unable to load shared object '/home/marc/R/x86_64-pc-linux-
    gnu-library/3.4/rJava/libs/rJava.so':
    libjvm.so: cannot open shared object file: No such file or directory
    Error: loading failed
    Execution halted


Any help would be welcome.









share|improve this question













share|improve this question




share|improve this question








edited Apr 26 at 10:00









Melebius

3,74841636




3,74841636










asked Apr 26 at 9:20









marc

62




62











  • I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
    – Melebius
    Apr 26 at 10:02

















  • I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
    – Melebius
    Apr 26 at 10:02
















I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
– Melebius
Apr 26 at 10:02





I am not sure whether JAVA_HOME is not a valid path, ignoring is important here but have you checked that /usr/lib/jvm/java-8-oracle you are setting as JAVA_HOME is a valid path in your system and contains a Java installation? If you are following an online guide, please provide a link in your question.
– Melebius
Apr 26 at 10:02











1 Answer
1






active

oldest

votes

















up vote
0
down vote













Try:




update-alternatives --config java




This gave an output like this:



  • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java

Add to your /etc/environment



JAVA_HOME='/usr/lib/jvm/java-8-oracle'



And then remove and reinstall r-base:




sudo apt-get remove r-base



sudo apt-get install r-base




Now try install rJava again.






share|improve this answer






















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "89"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028336%2fnot-able-to-install-rjava-in-r%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    Try:




    update-alternatives --config java




    This gave an output like this:



    • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java

    Add to your /etc/environment



    JAVA_HOME='/usr/lib/jvm/java-8-oracle'



    And then remove and reinstall r-base:




    sudo apt-get remove r-base



    sudo apt-get install r-base




    Now try install rJava again.






    share|improve this answer


























      up vote
      0
      down vote













      Try:




      update-alternatives --config java




      This gave an output like this:



      • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java

      Add to your /etc/environment



      JAVA_HOME='/usr/lib/jvm/java-8-oracle'



      And then remove and reinstall r-base:




      sudo apt-get remove r-base



      sudo apt-get install r-base




      Now try install rJava again.






      share|improve this answer
























        up vote
        0
        down vote










        up vote
        0
        down vote









        Try:




        update-alternatives --config java




        This gave an output like this:



        • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java

        Add to your /etc/environment



        JAVA_HOME='/usr/lib/jvm/java-8-oracle'



        And then remove and reinstall r-base:




        sudo apt-get remove r-base



        sudo apt-get install r-base




        Now try install rJava again.






        share|improve this answer














        Try:




        update-alternatives --config java




        This gave an output like this:



        • 2 /usr/lib/jvm/java-8-oracle/jre/bin/java

        Add to your /etc/environment



        JAVA_HOME='/usr/lib/jvm/java-8-oracle'



        And then remove and reinstall r-base:




        sudo apt-get remove r-base



        sudo apt-get install r-base




        Now try install rJava again.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 27 at 18:10

























        answered Apr 27 at 18:05









        cybrd0g

        11




        11



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028336%2fnot-able-to-install-rjava-in-r%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            Which professions warranted travel in Medieval times?

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Trouble downloading packages list due to a “Hash sum mismatch” error