xlsx icon indicating copy to clipboard operation
xlsx copied to clipboard

Aborted R Session- Fatal Error with library(xlsx)

Open dlaw0077 opened this issue 2 years ago • 8 comments

Hello, can anyone help me fix the issue stated above? I am taking a R Bootcamp and am trying to write to an excel, but whenever I do library(xlsx) the whole session is aborted.

I have gone through the whole process of uninstalling and reinstalling Java and I don't know what else to do. If this helps:

sessionInfo() R version 4.2.0 (2022-04-22 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

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

loaded via a namespace (and not attached): [1] compiler_4.2.0 tools_4.2.0

dlaw0077 avatar Apr 24 '22 00:04 dlaw0077

Hi, having the same issue and it looks like the package is not compatible with R 4.2. When I run the same script on R version 4.1.3, everything works as expected.

MichalLauer avatar Apr 29 '22 04:04 MichalLauer

Interesting! And apologies for the trouble! Does library('rJava'); .jinit() work for you? Crashes at startup are always important to check whether it is xlsx or the Java runtime itself that is causing the problem. I haven't added R 4.2 to CI yet (it is still quite new), but plan to do that!

colearendt avatar Apr 29 '22 09:04 colearendt

Hi, in my case fails only using RStudio.

rucoma avatar Apr 29 '22 10:04 rucoma

No worries:) After running library(rJava) and then .jinit(), R Session is aborted and terminated.

MichalLauer avatar Apr 30 '22 07:04 MichalLauer

Hello, library('rJava'); .jinit() does not work for me

dlaw0077 avatar Apr 30 '22 19:04 dlaw0077

Yes, if .jinit() fails, that suggests that the problem is with rJava or your java installation, not necessarily with xlsx. It's also possible that your Java installation conflicts somehow with RStudio running / environment variables that RStudio sets. (I would check the differences in the output of Sys.getenv() between a working / not working environment in the latter case)

Anyhow, xlsx unfortunately requires a functional rJava installation to work. If .jinit() is not working, you are better off asking for help in the rJava community and debugging your Java installation (there are several good debugging steps here). If you want to dispense with the Java dependency, then there are packages like openxlsx that do not have the Java dependency

colearendt avatar Apr 30 '22 19:04 colearendt

For me installing rJava from source removed this issue on 4.2.0 (.jinit() started working and xlsx loading without crash): install.packages("rJava", repos="https://rforge.net", type='source')

AndriyZhubryd avatar May 04 '22 07:05 AndriyZhubryd

Hi, everyone. After installing JDK 22, the bugs was fixed (When I only installed JRE, the error I met).

HuaZou avatar Mar 27 '24 06:03 HuaZou