rstudio crashing with tabulizer - "need to install the legacy Java SE 6 runtime"

On a macOS Catalina version 10.15.7 I'm trying to use the tabulizer package to extract a table from a .pdf and it is crashing RStudio and also crashing R (if I run it outside Rstudio). I get an error that says "To open 'RStudio' you need to install the legacy Java SE 6 runtime".

I have the most recently downloaded version of Java:

java -version
java version "15.0.1" 2020-10-20
Java(TM) SE Runtime Environment (build 15.0.1+9-18)
Java HotSpot(TM) 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

I tried to go to the java page and see if I could get an older version of Java (thought this seems sub-optimal) and it asked me where I want to put it saying it couldn't run both Java's on my machine.

Any help with how to get this to work would be great. Here is a screenshot

1 Like

I'm facing the same issue, hope someone in this community can help.

1 Like

I was able to reproduce this problem and found a fix. It looks like tabulizer and the rJava package it uses do not work well with Java versions past 11.

If you are using a Mac you can install Java 11 even if you've already installed a later version via this link:

Once you have Java 11 installed, before you load the tabulizer library, you need to let R know to use the Java 11 installation. The code below will do this:

Sys.setenv(JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home')
library(tabulizer)

This should prevent RStudio from crashing.

1 Like