R – Error: package or namespace load failed for “rJava”

Background

Users opens up a ticket regarding issues running an R Script on a new machine.

Error Message

Image

errorloadingpackage.rjava.20190109.0251pm

Textual


Error: package or namespace load failed for "rJava":
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: fun(libname, pkgname)
  error: No CurrentVersion entry in Software/JavaSoft registry!
  Try re-installing Java and make sure R and Java have matching architectures.

Explanation

Unable to load rJava module.

Troubleshooting

java

Is java Installed?

Outline

  1. OS Platform
    • OS :- Windows
      • GUI
        • Control Panel
      • Console
        • java.exe

OS Platform

MS Windows
GUI – Control Panel

Accessed Control Panel, but no Java Applet.controlpanel.20190109.0355pm

Console – java.exe

Syntax


java -version

Syntax – Check specifically for 64-bit


java -d64 -version

Output

Image

java.-d64.20190109.0407pm

Textual


>java -d64 -version
Unrecognized option: -d64
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

 

Remediation

java

Download Java Runtime Environment ( JRE)

Download 64-bit Java JRE from here :-

Java SE Runtime Environment 8 Downloads
Link

java.artifact.20190109.0412pm

Install Java

Install the download artifacts

Validate Java

Validate Java ( x64 )

Syntax

java -d64 -version

Output
Output – Before – Image

java.-d64.DoesNotSupportA64bitJVM.20190109.0419PM.PNG

Output – Before – Textual

Error : This Java instance does not support a 64-bit JVM.
Please install the desired version.

Output – After

java.-d64.Supports64bitJVM.20190109.0420PM.PNG

 

R

Access System

In R, issue call to system.

The call is to validate that the R Script can access the system and invoke the java executable.

System calls

System Call – java
Syntax

system('java -version")

Output
system.java.-version.20190109.0424pm

 

 

 

 

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s