B4J Question [SOLVED - Wayland to X11] Error in Ubuntu 22.04 with jdk-11.0.1

hatzisn

Expert
Licensed User
Longtime User
I have created an Ubuntu 22.04 virtual machine in virtual box and I tried to see how a b4j app I have created is displayed in linux.
I have gone to the thread of B4JPackager 11 and downloaded the jdk-11.0.1 Java for linux and unziped it. Now I have the following structure in linux.

/home/{username}/B4X/jdk-11.0.1
/home/{username}/B4X/DHQI_Prog

I try to run it from this directory "/home/{username}/B4X" with the following command:
./jdk-11.0.1/bin/java -jar ./DHQI_Prog/result.jar

and I get this result:
Error: JavaFX runtime components are missing, and are required to run this application

I check in the jdk-11.0.1 and the javafx are in there. Am I doing something wrong. In Ubuntu 20.04 it used to run like a charm without messing with it in any way if I recall correctly. Any suggestions anyone?
 

hatzisn

Expert
Licensed User
Longtime User
Hello, thank you both for answering.

@aeric I tried your solution and I get the same results

@DonManfred I tried your solution with a little modification. In Windows "java -jar ..." launches a new windows module since 2013 and javaw does not do this as it is explained in stackoverflow which I looked at. For linux you just run java -jar ...
So I tried with this command (the modules were taken from the jlinkargs.txt from the temp folder in objects (in windows - with a little cut off which was the b4j module):
./jdk-11.0.1/bin/java --module-path ./jdk-11.0.1/javafx/lib --add-modules jdk.charsets,jdk.crypto.ec,java.base,java.desktop,java.logging,javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,java.scripting,java.xml,jdk.unsupported,java.datatransfer,jdk.unsupported.desktop,jdk.jsobject,jdk.xml.dom -jar ./DHQI_Prog/result.jar

It seems to run something but then I get the following error:

B4X:
(java:2928): Gdk-CRITICAL **: 17:30:47.687: gdk_x11_display_set_window_scale: assertion 'GDK_IS_X11_DISPLAY (display)' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f9150aeb322, pid=2928, tid=2957
#
# JRE version: OpenJDK Runtime Environment (11.0.1+13) (build 11.0.1+13)
# Java VM: OpenJDK 64-Bit Server VM (11.0.1+13, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  [libX11.so.6+0x2b322]
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport -p%p -s%s -c%c -d%d -P%P -u%u -g%g -- %E" (or dumping to /home/hatzisn/B4X/core.2928)
#
# An error report file with more information is saved as:
# /home/hatzisn/B4X/hs_err_pid2928.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

I am not sure what this means... Has a lib changed and it does not work properly any more? And where is this lib? The application is a "TRANSPARENT" app with a panel for defining the borders of the form.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Are you using the latest version of Ubuntu Jammy?
By default you should have logged in to Wayland but B4J app would have issue running on this new display server. You need to log out and log in to X11 server session.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Are you using the latest version of Ubuntu Jammy?
By default you should have logged in to Wayland but B4J app would have issue running on this new display server. You need to log out and log in to X11 server session.

Thank you for answering. It shows that you are a linux guy. What you said before I google it sounded completely incomprehensible to me. Thanks to your advise I managed to get it working with the following four steps (applicable in Ubuntu 22.04) :

1. sudo nano /etc/gdm3/custom.conf
2. #WaylandEnable=false --> remove #
3. In [daemon] section add: DefaultSession=gnome-xorg.desktop
4. Reboot

I would like to buy you a cup of cofee for thanking you for your help and I will click your link in a few moments (just to find my credentials).

Thank you again.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I am not really a Linux guy but I have encountered same problem as you before. ?

P/S: Thanks for coffee ☕️ Nikolaos
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…