Java gui without desktop environment

gnomejavaswingswtuser interface

Is it possible to use java gui frameworks (such as Swing, SWT or javaFX) without desktop environment, such as Gnome?

Best Answer

Although I haven't encountered this situation myself, I would suspect that this would be the case where the HeadlessException would come into play.

The Javadoc for HeadlessException says the following:

Thrown when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse.

The HeadlessException is thrown by the constructors of various classes that deal with the GUI, such as Dialog and JFrame, so I would suspect that in non-GUI environments, the HeadlessException will be thrown when attempting to use a GUI toolkit.