bell-sw/Liberica

JavaFX Headless on Windows

java71 opened this issue · 3 comments

Hi,

I am developping a server application that processed images : creating bitmap images for instance...
Of course, my objective is to get a cross-platform single jar file!
I use Full LIBERICA NIK v22.3 on WINDOWS 11.

Everything works well when I use standard Liberica native image on Windows but fails on LINUX because of 'no display' !
So, if my understanding is correct, I need to use JavaFX with spcial 'MONOCLE' configuration...

  • Is it the right way ?

Again, if my reading is correct I can use MONOCLE configuration by applying arguments as follows
-Dtestfx.robot=glass
-Dglass.platform=Monocle
-Dmonocle.platform=Headless
-Dprism.order=sw

But it fails ! Error is "Failed to load Glass factory class".

So my questions are :

  • Does LIBERICA include MONOCLE capabilities ?
  • Is is possible to use it on LINUX (without display) ? on windows ?
  • Is there any tutorial for testing LIBERICA JavaFX with headless configuration ?

Thanks a lot for your help

Liberica jdk contains monocle only for Linux arm32 platform.
For example, bellsoft-jdk17.0.6+10-linux-arm32-vfp-hflt-full.tar.gz includes the following monocle shared libraries:

ls jdk-17.0.6-full/lib/lib*monocle*
jdk-17.0.6-full/lib/libglass_monocle_epd.so 
jdk-17.0.6-full/lib/libglass_monocle_x11.so
jdk-17.0.6-full/lib/libglass_monocle.so 
jdk-17.0.6-full/lib/libprism_es2_monocle.so

One way to run JavaFX applications without display on Linux is using X virtual framebuffer.
In docker it looks like:

docker pull winstonpro/ubuntu-desktop
docker run --rm -v /tmp/mount:/root/mount -it winstonpro/ubuntu-desktop bash
docker ps
docker exec -it <container-id> bash
apt update
apt  install -y mesa-utils and libgl1-mesa-glx
apt install xvfb
Xvfb :99 &
export DISPLAY=:99
jdk-11.0.18-full/bin/java  -Dprism.order=sw HelloWorld

Thanks for your reply !
By the way, my objective is to use NIK (native-image) in order to have a single executable file gathering whole project...
Is there any plan/roadmap for integrating MONOCLE into LIBERICA for other platform ?