colearendt / xlsx

An R package to interact with Excel files using the Apache POI java library
https://colearendt.github.io/xlsx/
86 stars 32 forks source link

Installation failure; Error occurred during initialization of VM; java/lang/NoClassDefFoundError: java/lang/Object #186

Open tedmoorman opened 2 years ago

tedmoorman commented 2 years ago

I'm receiving an error during the installation:

$ R CMD INSTALL ~/xlsx
* installing to library ‘/projects/CI_Analysts/R/x86_64-pc-linux-gnu-library/3.5’
* installing *source* package ‘xlsx’ ...
** package ‘xlsx’ successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
ERROR: loading failed

I have rJava and xlsxjars installed. I also ran tar fxz ~/xlsx_0.6.5.tar.gz and R CMD javareconf -e before running the install, which fixes most Java installation related problems. Here is my sessionInfo():

R version 3.5.3 (2019-03-11)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux

Matrix products: default
BLAS: /opt/R/R-3.5.3/lib64/R/lib/libRblas.so
LAPACK: /opt/R/R-3.5.3/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.5.3 tools_3.5.3    renv_0.14.0 

Any help is appreciated.

colearendt commented 2 years ago

Thanks for reporting this! This sounds like an rJava issue more than xlsx since java/lang/Object is a very core Java class.

Would you mind starting a fresh R session, and trying:

library(rJava)
.jinit()

This can help isolate rJava as the issue. xlsx runs .jinit() when you load the package, which initializes the Java VM. As such, we tend to highlight issues in the underlying JVM 🙈 The issue is probably outside of this package, I would guess

tedmoorman commented 2 years ago

Ended up crashing RStudio! Output from running that code in the Terminal is below.

> library(rJava)
> .jinit()
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object