Not able to install rJava in R (ubuntu 18.04)












2














After upgrading from Ubuntu 16 to 18.4, I am not able to install the rJava package in R.



I read other posts like this, but I didn't solve my issue.
if I run install.packages("rJava") on R, Results is this:



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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/rJava’


when I run sudo R CMD javareconf:



Java interpreter : /usr/lib/jvm/java-8-oracle/jre/bin/java
Java version : 1.8.0_181
Java home path : /usr/lib/jvm/java-8-oracle
Java compiler : /usr/lib/jvm/java-8-oracle/bin/javac
Java headers gen.: /usr/lib/jvm/java-8-oracle/bin/javah
Java archive tool: /usr/lib/jvm/java-8-oracle/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)/jre/lib/amd64/server -ljvm
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -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
Java library path: $(JAVA_HOME)/jre/lib/amd64/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
Updating Java configuration in /usr/lib/R
Done.


Any help would be welcome.










share|improve this question



























    2














    After upgrading from Ubuntu 16 to 18.4, I am not able to install the rJava package in R.



    I read other posts like this, but I didn't solve my issue.
    if I run install.packages("rJava") on R, Results is this:



    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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/rJava’


    when I run sudo R CMD javareconf:



    Java interpreter : /usr/lib/jvm/java-8-oracle/jre/bin/java
    Java version : 1.8.0_181
    Java home path : /usr/lib/jvm/java-8-oracle
    Java compiler : /usr/lib/jvm/java-8-oracle/bin/javac
    Java headers gen.: /usr/lib/jvm/java-8-oracle/bin/javah
    Java archive tool: /usr/lib/jvm/java-8-oracle/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)/jre/lib/amd64/server -ljvm
    gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -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
    Java library path: $(JAVA_HOME)/jre/lib/amd64/server
    JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
    JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
    Updating Java configuration in /usr/lib/R
    Done.


    Any help would be welcome.










    share|improve this question

























      2












      2








      2







      After upgrading from Ubuntu 16 to 18.4, I am not able to install the rJava package in R.



      I read other posts like this, but I didn't solve my issue.
      if I run install.packages("rJava") on R, Results is this:



      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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/rJava’


      when I run sudo R CMD javareconf:



      Java interpreter : /usr/lib/jvm/java-8-oracle/jre/bin/java
      Java version : 1.8.0_181
      Java home path : /usr/lib/jvm/java-8-oracle
      Java compiler : /usr/lib/jvm/java-8-oracle/bin/javac
      Java headers gen.: /usr/lib/jvm/java-8-oracle/bin/javah
      Java archive tool: /usr/lib/jvm/java-8-oracle/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)/jre/lib/amd64/server -ljvm
      gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -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
      Java library path: $(JAVA_HOME)/jre/lib/amd64/server
      JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
      JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
      Updating Java configuration in /usr/lib/R
      Done.


      Any help would be welcome.










      share|improve this question













      After upgrading from Ubuntu 16 to 18.4, I am not able to install the rJava package in R.



      I read other posts like this, but I didn't solve my issue.
      if I run install.packages("rJava") on R, Results is this:



      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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/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/salvatore/R/x86_64-pc-linux-gnu-library/3.5/rJava’


      when I run sudo R CMD javareconf:



      Java interpreter : /usr/lib/jvm/java-8-oracle/jre/bin/java
      Java version : 1.8.0_181
      Java home path : /usr/lib/jvm/java-8-oracle
      Java compiler : /usr/lib/jvm/java-8-oracle/bin/javac
      Java headers gen.: /usr/lib/jvm/java-8-oracle/bin/javah
      Java archive tool: /usr/lib/jvm/java-8-oracle/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)/jre/lib/amd64/server -ljvm
      gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -fpic -g -O2 -fdebug-prefix-map=/build/r-base-oNcpyf/r-base-3.5.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -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
      Java library path: $(JAVA_HOME)/jre/lib/amd64/server
      JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux
      JNI linker flags : -L$(JAVA_HOME)/jre/lib/amd64/server -ljvm
      Updating Java configuration in /usr/lib/R
      Done.


      Any help would be welcome.







      18.04 java r rstudio






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 27 '18 at 15:52









      Salvo Comunque

      2014




      2014






















          2 Answers
          2






          active

          oldest

          votes


















          1














          In my case, I also had to use: sudo R CMD javareconf, to make it work.






          share|improve this answer































            1














            On my clean installation of Ubuntu 18.04 LTS I did the following



            sudo apt-get install r-base-dev default-jdk


            (so I have R 3.4 from official repository).



            Then in R or in RStudio 1.1.456 session:



            install.packages('rJava')


            and it ended with



            * DONE (rJava)




            Note: I'm using default OpenJDK 11 from Bionic repository -



            $ update-java-alternatives -l
            java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64





            share|improve this answer























            • I'm done. On R it work fine, the issues occour on Rstudio.
              – Salvo Comunque
              Aug 27 '18 at 16:29












            • I can't reproduce your issue using R 3.4. Why do you use R 3.5?
              – N0rbert
              Aug 27 '18 at 16:34








            • 1




              Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
              – Salvo Comunque
              Aug 27 '18 at 17:02











            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%2f1069463%2fnot-able-to-install-rjava-in-r-ubuntu-18-04%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            In my case, I also had to use: sudo R CMD javareconf, to make it work.






            share|improve this answer




























              1














              In my case, I also had to use: sudo R CMD javareconf, to make it work.






              share|improve this answer


























                1












                1








                1






                In my case, I also had to use: sudo R CMD javareconf, to make it work.






                share|improve this answer














                In my case, I also had to use: sudo R CMD javareconf, to make it work.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 4 '18 at 13:08









                Yufenyuy Veyeh Dider

                1,5454924




                1,5454924










                answered Dec 4 '18 at 8:51









                Niels

                262




                262

























                    1














                    On my clean installation of Ubuntu 18.04 LTS I did the following



                    sudo apt-get install r-base-dev default-jdk


                    (so I have R 3.4 from official repository).



                    Then in R or in RStudio 1.1.456 session:



                    install.packages('rJava')


                    and it ended with



                    * DONE (rJava)




                    Note: I'm using default OpenJDK 11 from Bionic repository -



                    $ update-java-alternatives -l
                    java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64





                    share|improve this answer























                    • I'm done. On R it work fine, the issues occour on Rstudio.
                      – Salvo Comunque
                      Aug 27 '18 at 16:29












                    • I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                      – N0rbert
                      Aug 27 '18 at 16:34








                    • 1




                      Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                      – Salvo Comunque
                      Aug 27 '18 at 17:02
















                    1














                    On my clean installation of Ubuntu 18.04 LTS I did the following



                    sudo apt-get install r-base-dev default-jdk


                    (so I have R 3.4 from official repository).



                    Then in R or in RStudio 1.1.456 session:



                    install.packages('rJava')


                    and it ended with



                    * DONE (rJava)




                    Note: I'm using default OpenJDK 11 from Bionic repository -



                    $ update-java-alternatives -l
                    java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64





                    share|improve this answer























                    • I'm done. On R it work fine, the issues occour on Rstudio.
                      – Salvo Comunque
                      Aug 27 '18 at 16:29












                    • I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                      – N0rbert
                      Aug 27 '18 at 16:34








                    • 1




                      Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                      – Salvo Comunque
                      Aug 27 '18 at 17:02














                    1












                    1








                    1






                    On my clean installation of Ubuntu 18.04 LTS I did the following



                    sudo apt-get install r-base-dev default-jdk


                    (so I have R 3.4 from official repository).



                    Then in R or in RStudio 1.1.456 session:



                    install.packages('rJava')


                    and it ended with



                    * DONE (rJava)




                    Note: I'm using default OpenJDK 11 from Bionic repository -



                    $ update-java-alternatives -l
                    java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64





                    share|improve this answer














                    On my clean installation of Ubuntu 18.04 LTS I did the following



                    sudo apt-get install r-base-dev default-jdk


                    (so I have R 3.4 from official repository).



                    Then in R or in RStudio 1.1.456 session:



                    install.packages('rJava')


                    and it ended with



                    * DONE (rJava)




                    Note: I'm using default OpenJDK 11 from Bionic repository -



                    $ update-java-alternatives -l
                    java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Aug 27 '18 at 17:09

























                    answered Aug 27 '18 at 16:18









                    N0rbert

                    21.5k547101




                    21.5k547101












                    • I'm done. On R it work fine, the issues occour on Rstudio.
                      – Salvo Comunque
                      Aug 27 '18 at 16:29












                    • I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                      – N0rbert
                      Aug 27 '18 at 16:34








                    • 1




                      Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                      – Salvo Comunque
                      Aug 27 '18 at 17:02


















                    • I'm done. On R it work fine, the issues occour on Rstudio.
                      – Salvo Comunque
                      Aug 27 '18 at 16:29












                    • I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                      – N0rbert
                      Aug 27 '18 at 16:34








                    • 1




                      Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                      – Salvo Comunque
                      Aug 27 '18 at 17:02
















                    I'm done. On R it work fine, the issues occour on Rstudio.
                    – Salvo Comunque
                    Aug 27 '18 at 16:29






                    I'm done. On R it work fine, the issues occour on Rstudio.
                    – Salvo Comunque
                    Aug 27 '18 at 16:29














                    I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                    – N0rbert
                    Aug 27 '18 at 16:34






                    I can't reproduce your issue using R 3.4. Why do you use R 3.5?
                    – N0rbert
                    Aug 27 '18 at 16:34






                    1




                    1




                    Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                    – Salvo Comunque
                    Aug 27 '18 at 17:02




                    Perfect, I removed R 3.5 and installed R3.4, after installing R studio, all thing works fine. Thank you so mutch for your answer.
                    – Salvo Comunque
                    Aug 27 '18 at 17:02


















                    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.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • 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%2f1069463%2fnot-able-to-install-rjava-in-r-ubuntu-18-04%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

                    mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?