Not able to install rJava in R












0















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 '18 at 10:02


















0















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 '18 at 10:02
















0












0








0








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.







16.04 software-installation java r






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 26 '18 at 10:00









Melebius

4,61451839




4,61451839










asked Apr 26 '18 at 9:20









marcmarc

63




63













  • 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 '18 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 '18 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 '18 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 '18 at 10:02












1 Answer
1






active

oldest

votes


















0














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',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    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















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    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






























      0














      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




























        0












        0








        0







        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 '18 at 18:10

























        answered Apr 27 '18 at 18:05









        cybrd0gcybrd0g

        11




        11






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Ask Ubuntu!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            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















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

            Mangá

            Eduardo VII do Reino Unido