Skip to content
Home » Error in .jcall(“RJavaTools”…) when importing large xlsx files in R

Error in .jcall(“RJavaTools”…) when importing large xlsx files in R

Recently I had to read in a folder full of large Excel (.xlsx) files. I did as I usually did and use the xlsx library. However, reading in the largest files produced an error:

“Error in .jcall(“RJavaTools”, “Ljava/lang/Object;”, “invokeMethod”, cl, : java.lang.OutOfMemoryError: Java heap space”

I don’t know what cause the issues, but solving this problem was rather easy. I switched to the openxlsx library. This package completely removes the dependency on Java.

Its read and write times are more or less the same and the read.xlsx() function offers the same functionalities as the xlsx library.

Openxlsx is my newest friend for interacting with Excel files.

By the way, if you’re having trouble understanding some of the code and concepts, I can highly recommend “An Introduction to Statistical Learning: with Applications in R”, which is the must-have data science bible. If you simply need an introduction into R, and less into the Data Science part, I can absolutely recommend this book by Richard Cotton. Hope it helps!

Great success!

Say thanks, ask questions or give feedback

Technologies get updated, syntax changes and honestly… I make mistakes too. If something is incorrect, incomplete or doesn’t work, let me know in the comments below and help thousands of visitors.

1 thought on “Error in .jcall(“RJavaTools”…) when importing large xlsx files in R”

Leave a Reply

Your email address will not be published. Required fields are marked *