Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java GUI support on Wayland

I want to include Java GUI support on my system which has only wayland backend supported. I tried to include OpenJDK-7-jre package, but it seems to have X11 dependency. I compiled ‘Openjre-8’ package successfully and included in my image. But, it can run only Java applications without GUI. When I try to run any JAVA SWING API based GUI program I get the following error:

Exception in thread "main" java.awt.HeadlessException                           
        at java.awt.GraphicsEnvironment.checkHeadless(Unknown Source)           
        at java.awt.Window.<init>(Unknown Source)                               
        at java.awt.Frame.<init>(Unknown Source)                                
        at java.awt.Frame.<init>(Unknown Source)                                
        at javax.swing.JFrame.<init>(Unknown Source)                            
        at GuiApp1.<init>(GuiApp1.java:25)                                      
        at GuiApp1.main(GuiApp1.java:20)  

Is it possible to run Java GUI programs on wayland? How do we do it?

like image 282
vinoth kumar Avatar asked Aug 29 '16 01:08

vinoth kumar


1 Answers

This is kinda possible. AWT stands for "abstract" window toolkit. There are several extensions to AWT where the peer is QT or GTK instead of the default JDK.

Qt: https://cvs.savannah.gnu.org/viewvc/classpath/classpath/gnu/java/awt/peer/qt/

Gtk: https://cvs.savannah.gnu.org/viewvc/classpath/classpath/gnu/java/awt/peer/gtk/

Note these sources are old and might need some revisions to work with latest JDK.

like image 89
Peter Quiring Avatar answered Oct 23 '22 20:10

Peter Quiring