Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetal error: No java runtime present. Need the legacy java SE 6 runtime #183

Open
yifengyuan opened this issue Nov 4, 2021 · 1 comment

Comments

@yifengyuan
Copy link

yifengyuan commented Nov 4, 2021

Sys.setenv(JAVA_HOME='/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home')
install.packages("rJava",type='source')
remotes::install_github("colearendt/xlsx",force = TRUE)

library(xlsx)
library(readxl)
library(rJava)

d <- read.table("test_table.txt", sep="\t", header=TRUE, fill=TRUE, row.names = 1, as.is = T)

wb <- createWorkbook()
sheet <- createSheet(wb, "Sheet")
addDataFrame(d, sheet)
rows <- getRows(sheet)
...
...

#Everything is fine till running this command:
cs1 <- CellStyle(wb) + Fill(backgroundColor="lavender")

R encounter a fetal error:
No java runtime present, requesting install.

To open Rstudio, you need to install the legacy java SE 6 runtime.

R version 4.0.2 (2020-06-22) -- "Taking Off Again"

yifengyuan@YifengMacAir ~ $ sudo R CMD javareconf
Password:
Java interpreter : /usr/bin/java
Java version : 17.0.1
Java home path : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Java compiler : /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar

trying to compile and link a JNI program
detected JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
detected JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/include/darwin -I/usr/local/include -fPIC -Wall -g -O2 -c conftest.c -o conftest.o
clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o conftest.so conftest.o -L/Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home/lib/server -ljvm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation

JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk-17.0.1.jdk/Contents/Home
Java library path: $(JAVA_HOME)/lib/server
JNI cpp flags : -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin
JNI linker flags : -L$(JAVA_HOME)/lib/server -ljvm
Updating Java configuration in /Library/Frameworks/R.framework/Resources
Done.

yifengyuan@YifengMacAir ~ $ java -version
java version "17.0.1" 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

Please advice. Thank you very much.

@yifengyuan yifengyuan changed the title no java SE. Need java legacy 6 fetal error: No java runtime present. Need the legacy java SE 6 runtime Nov 4, 2021
@colearendt
Copy link
Owner

Strange!! Are you using RStudio here? I see this message:

To open Rstudio, you need to install the legacy java SE 6 runtime.

What version of RStudio are you using? What happens if you run this program in your terminal? It would be good to know if this is a problem that xlsx is having or if xlsx is just highlighting and underlying issue in the IDE / elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants