EC2 Tutorials: rJava – annoying enough to have its own blog post

Tweet about this on TwitterShare on LinkedInShare on FacebookGoogle+Share on StumbleUponEmail to someone

One of the most frustrating items that I’ve been trying to install on my EC2 instance is rJava. Its an R package that lots of other packages have as a dependency, including glmulti and MongoDB.

I’ve spent a fair few hours trying to get this installed, constantly receiving the error message:

configure: error: Java Development Kit (JDK) is missing or not registered in R
Make sure R is configured with full Java support (including JDK). Run
R CMD javareconf
as root to add Java support to R.

I dutifully ran the recommended line of code (several times, as root, as ec2-user, etc. etc. etc.)

About half way through this journey I checked with another EC2 instance with R installed and received the same error, which at least reassured me that I had not completely screwed up my R installation, so kept persevering.

My main line of inquiry was checking that the JDK was installed properly – from my limited Linux experience it looked OK, but I also came across some forum posts

Cutting a long story short, I finally came across this post and found this beautiful line of code, which hopefully will sort out your problems (or at least check off the problem that I had):

yum install java-1.6.0-openjdk-devel

Machine Learning and Analytics based in London, UK