I am trying to install rJava and RJDBC on Databricks (from notebook).
I ran recommended lines:
%sh ls -l /usr/bin/java ls -l /etc/alternatives/java ln -s /usr/lib/jvm/java-8-openjdk-amd64 /usr/lib/jvm/default-java R CMD javareconf Installation went fine, but when I try
library(rJava) I get this error:
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 '/local_disk0/.ephemeral_nfs/envs/rEnv-83cc4969-e3a2-430d-83c5-b43067bdea17/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory Error: package or namespace load failed for ‘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 '/local_disk0/.ephemeral_nfs/envs/rEnv-83cc4969-e3a2-430d-83c5-b43067bdea17/rJava/libs/rJava.so': libjvm.so: cannot open shared object file: No such file or directory What do I do in this case?
UPDATE
Following the link rJava prerequisites after installing rJava and RJDBC I ran
dyn.load('/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so') library(rJava) and got the following output:
Error in dyn.load("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so") : unable to load shared object '/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so': /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so: cannot open shared object file: No such file or directory Error in dyn.load("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so"): unable to load shared object '/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so': Error in dyn.load("/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so"): unable to load shared object '/usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so': /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/server/libjvm.so: cannot open shared object file: No such file or directory Another update
The following line is not just necessary to verify installation, it is a part of installation and it is possible that path is different. Here is pass that worked for me:
dyn.load('/usr/lib/jvm/zulu11-ca-amd64/lib/server/libjvm.so') And here is some philosophy behind it.
"rJava uses JNI to hook into the JVM. For JNI to work, it needs access to the shared library. dyn.load is a r function that helps loads native shared object libraries (libjvm.so) into the namespace so any functions that need to call into java can be executed"
lsseems weird. Are you able to execute thedyn.loadline with no errors?lscommands points to/usr/lib/jvm/java-8-openjdk-amd64dyn.loadand posted update above.