cdkr
cdkr copied to clipboard
view.image.2d doesn't work if no proper X11 is available
Hello,
The view.image.2d()
function currently results in error if the DISPLAY
variable is set while X11 is not actually available, eg
Error in .jcall(mi, "[B", "getBytes", as.integer(depictor$getWidth()), :
java.lang.NoClassDefFoundError: Could not initialize class java.awt.GraphicsEnvironment$LocalGE
Such an (unfortunate) situation is actually happening with RStudio Docker images. Unsetting DISPLAY
prior to starting R
is a workaround, as Java awt automatically starts in headless mode. Setting headless manually also works:
rJava::J("java.lang.System")$setProperty("java.awt.headless","true")
I wonder if such a workaround could be implemented? I guess forcing headless for view.image.2d()
should be fine in any case?
Cheers, Rick