B4J Question B4J app from Windows to Linux

Wien.Mart

Member
Licensed User
Longtime User
Hello All,

I have been trying to make an app with multiple forms (GUI) to work on Linux. I am using Rocky Linux (RL) since this is closest to CentOS 8 (I am a newbie to Linux and I have a lot of learning to do). I installed java 11 downloaded from B4X site as well as the B4J-bridge.jar and it seems to be working after a lot of tries. Finally, I see on the terminal that I am connected. I use a windows machine to connect to the bridge to RL. I got the message below on B4J IDE:

WARNING: package com.sun.glass.ui.win not in javafx.graphics

I did some more searching and added the line

#VirtualMachineArgs: --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED

in the Region Project Attributes and run in release mode. I got another error

Unrecognized option: --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

May I ask, where am I going wrong or what do I need to add. I see in tutorials that members are able to run their creations in Mac, Raspberry Pi and Linux.

Thank you in advance.

Warm regards,

Martin
 

Wien.Mart

Member
Licensed User
Longtime User
Dear Erel ... I think so because I downloaded the zip from one of the threads about Linux and B4J. Thank you ....

I confirm that I have the java version you mentioned. I compared release notes and they are the same.

The version on the Linux and Windows machine are the same ...
 
Last edited:
Upvote 0

aeric

Expert
Licensed User
Longtime User
Type “java -version” in terminal to check your version but if you are running b4j-bridge from openjdk downloaded from b4x.com then it is the correct version.
 
Upvote 0

Wien.Mart

Member
Licensed User
Longtime User
Dear Erel,

Below is a screen capture .... thanks. ....

1642499034070.png
 
Upvote 0

Wien.Mart

Member
Licensed User
Longtime User
Below is the entire error shown on the IDE

#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f8776a95def, pid=6047, tid=6089
#
# 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+0x30def] XInternAtom+0x3f
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e" (or dumping to /home/martin/tempjars/core.6047)
#
# An error report file with more information is saved as:
# /home/martin/tempjars/hs_err_pid6047.log
~e:
(java:6047): Gdk-CRITICAL **: 10:46:03.431: gdk_x11_display_set_window_scale: assertion 'GDK_IS_X11_DISPLAY (display)' failed
#
# 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.
#


Thanks
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I don’t know it would help or not, maybe try do an update.
 
Upvote 0

xulihang

Active Member
Licensed User
Longtime User
I'd recommend using liberica jdk which bundles javafx
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Which Desktop Environment is it running? KDE?
What I understand CentOS is usually use as server. I tried openEuler OS which is based on RedHat and I feel it looks weird running Desktop GUI app. Not sure is it because of UKUI DE. Maybe some distros doesn’t have good support for JavaFX. I prefer Ubuntu running on Gnome.
 
Upvote 0

Wien.Mart

Member
Licensed User
Longtime User
@xulihang ... i will look into the liberica jdk ...

@aeric ... this may be the issue indeed ... i am trying to run the app with GUI on a server ... i will look into the support for rocky linux for javafx

thanks both ... :)
 
Upvote 0

xulihang

Active Member
Licensed User
Longtime User
You may need to run the app through vnc instead of ssh.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
(java:6047): Gdk-CRITICAL **: 10:46:03.431: gdk_x11_display_set_window_scale: assertion 'GDK_IS_X11_DISPLAY (display)' failed
It seems the problem with OpenJDK11 with Wayland display server. The workaround is execute java command as:
Code:
 java -Djdk.gtk.version=2 ...

 
Upvote 0

Wien.Mart

Member
Licensed User
Longtime User
It seems the problem with OpenJDK11 with Wayland display server. The workaround is execute java command as:
Code:
 java -Djdk.gtk.version=2 ...

Thanks but it did not work. The IDE still connected but the error is the same.

If I use Linux Mint (from a forum post here) will it work, knowing that it is compiled in Wine and from Mint to Rocky?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
Thanks but it did not work. The IDE still connected but the error is the same.

If I use Linux Mint (from a forum post here) will it work, knowing that it is compiled in Wine and from Mint to Rocky?
What is tested by me so far is on Ubuntu Linux 20.04 LTS.
I am not sure which version of Rocky Linux you are running. I would suggest you use the desktop environment (DE) which is running on X11 display server and see is the problem gone.
May I know any reason you picked up Rocky Linux?
 
Upvote 0
Top