Adding GPU to Java application

Adding GPU to Java application running on Oracle Linux 9.5. Application is housed on a headless VM. Users connect from a thin client via VNC under which the application is started. Looking to leverage the GPU and accelerator. Is a stable solution possible?

Tried adding the following to the shell script starting the application. Sometimes the application starts and nvidia-smi lists the application. Often, this is true but the application crashes. The application’s UI framework is Java AWT + Swing.

export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __NV_PRIME_RENDER_OFFLOAD=1
export __VK_LAYER_NV_optimus=NVIDIA_only
export GDK_BACKEND=x11
export _JAVA_AWT_WM_NONREPARENTING=1

Also tried adding the following to the Java app’s wrapper:
wrapper.env.__GLX_VENDOR_LIBRARY_NAME=nvidia
wrapper.env.__NV_PRIME_RENDER_OFFLOAD=1
wrapper.env.__VK_LAYER_NV_optimus=NVIDIA_only