Error of java path on loading rJava package
Solution 1
sudo R CMD javareconf
This works perfectly. Keeping this here if someone reads this in future.
Solution 2
I have a VM of Ubuntu 14.04 LTS on VirtualBox, and the real path of installation of my java-jdk is the following :
/usr/lib/jvm/java-7-openjdk-amd64
This command worked very fine for my situation. I had this type of error from installation o rJava package on RStudio:
*./configure: line 3736: /usr/lib/jvm/default-java/jre/bin/java: No such file or directory*
First I' have modified the profile in this way : sudo gedit /etc/profile and then added this instructions at the eof:
JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
After this, from terminal session I've typed the command:
sudo R CMD javareconf
and the package rJava was successfully installed.
Note: You might also have to set the LD_LIBRARY_PATH
environment variable, before running sudo R CMD javareconf
.
Related videos on Youtube
Aman Mathur
LinkedIn: https://www.linkedin.com/in/aman-mathur-ba341771 Seeking Summer/Fall Internship, Graduate Student at University of Southern California I have 2 years of industrial experience in Data analytics and Machine learning. I have strong experience with programming languages like R and Python. I have developed business solutions using tools like Google Analytics Premium, Adobe Analytics, Excel VBA. My current research is on identification and classification of Hindi Dialects. We have also created 6000 lines of tagged Hindi dialog corpus according to their dialects
Updated on June 15, 2022Comments
-
Aman Mathur almost 2 years
I am trying to load 'rJava' package in my Unix machine. Before loading I have set the path using
Sys.setenv("JAVA_HOME= myfilepath")
in my R script.
Despite this I am getting the following error (Below is the part of the error):
checking Java support in R... present: interpreter : '/usr/lib/jvm/jre/bin/java' archiver : '/usr/lib/jvm/jre/../bin/jar' compiler : '/usr/lib/jvm/jre/../bin/javac' header prep.: '/usr/lib/jvm/jre/../bin/javah' cpp flags : '-I/usr/lib/jvm/java/include I/usr/lib/jvm/java/include/linux' java libs : '-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server -ljvm' checking whether Java run-time works... ./configure: line 3729: /usr/lib/jvm/jre/bin/java: No such file or directory no configure: error: Java interpreter '/usr/lib/jvm/jre/bin/java' does not work
As you can see the error shows that /usr/lib/jvm/jre/bin/java: No such file or directory. But I have not set this as myfilepath. How do I prevent the installer from looking at this path?
Kindly help.
-
David Arenburg almost 9 yearsTake a look here maybe. There are some good tips there.
-
Aman Mathur almost 9 yearsI had check that post before posting the question. I tried everything there. Does not seem to work for me.
-
Manoj G almost 9 yearsDid you tried
sudo R CMD javareconf
I had the same problem. rJava trying to check the directories which is not at all there in my system. But after running the above config command, it worked for me. -
gladmax over 8 yearsthanks Manoj sudo R CMD javareconf worked for me.
-
-
CoderGuy123 over 7 yearsThis didn't have any effect for me (Mint 18).
-
pableiros over 7 yearsLinks to external resources are encouraged, but please add context around the link so your fellow users will have some idea what it is and why it’s there. Always quote the most relevant part of an important link, in case the target site is unreachable or goes permanently offline.
-
ZN13 over 7 years@Deleet Worked for me (Ubuntu Server 16.04) , after I installed openjdk-7-jdk
-
quintindk almost 7 yearsWorked for me, ubuntu 16.04.2!
-
joaoal over 6 yearsFor this to work you need to have java installed first. See here for instructions: stackoverflow.com/questions/14788345/…
-
Leo over 6 yearsAfter
sudo R CMD javareconf
, runsudo rstudio-server restart
. -
2D1C about 4 yearsAlso note that as of version 0.9-12(2020-03-23) rJava has an --enable-dynload option to enable dynamic loading of the JVM. The changelog also shows the order rJava uses to search for the JVM which might be useful. github.com/s-u/rJava/blob/master/NEWS