I'm trying to port an SWT desktop application to Ubuntu. Have downloaded Eclipse Neon (6.4.2)
for Ubuntu and swt-4.6.2-gtk-linux-x86_64.zip
, configured libraries in the project build path to point to the swt.jar from the downloaded swt zip.
Eclipse works fine, the application gets compiled, but crashes when trying to execute the following line of the code:
Display display = Display.getDefault();
It's the very first call to the SWT in the program.
Eclipse writes to console the following message :
(SWT:3351): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'
(SWT:3351): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(SWT:3351): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
(SWT:3351): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(SWT:3351): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(SWT:3351): GLib-GObject-WARNING **: invalid (NULL) pointer instance
(SWT:3351): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
(SWT:3351): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplay'
(SWT:3351): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(SWT:3351): GLib-GObject-CRITICAL **: g_type_register_static: assertion 'parent_type > 0' failed
(SWT:3351): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed
(SWT:3351): GLib-GObject-CRITICAL **: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f729ae932b7, pid=3351, tid=0x00007f72e24aa700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_111-b14) (build 1.8.0_111-b14)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.111-b14 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libgdk-x11-2.0.so.0+0x4e2b7] gdk_display_open+0x57
#
Ubuntu 16.04 LTS. Under Windows, the application works fine. What may be the reason and how can I fix it?
PS
A rather strange thing. When it is packed to jar outside the Ubuntu (under Windows, along with the Linux SWT and Jar-in-Jar loader), this Jar starts to work under Ubuntu, exept the file open dialog, that draws just an empty window instead of the dialog. It behaves this way 2 (two) times. The third time I start it it crushes again with the same message ((SWT:3351): GLib-GObject-WARNING
etc). Restarting Ubuntu and setting `SWT_GTK3=0' don't affect.
PPS
Ubuntu is running in Hyper-V under Windows2008, if it matters...