workaround to run GUI apps on only text env.?
Hi gurus,
I have a GUI application and recently, I tried to add a shell mode support to it but, unfortunately, I found out that this apps is strongly GUI dependent. For now, I kinda cheated hiding any GUI display when run in shell mode.
In fact, running from shell mode will still use awt, javax libraries but will not display any GUI. Therefore, when running this application in an only text environment will throw the exception "Can't connect to X11 window server".
Is there any possible solution to workaround this issue? I'd like to try every possible solution before trying to remove completely the GUI dependence because this will be a major change for me.
Any help will be greatly appreciated.
Ward
> Have you tried catching the exception and ignoring it?
yes but it dies anyway throwing the exception.
Also, I'm trying using the Headless support but I'm getting a HeadlessException:
bash-2.05b$ java -Djava.awt.headless=true -cp testTool.jar test.JTestoraptor.Main
Exception in thread "main" java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
at java.awt.Window.<init>(Window.java:274)
at java.awt.Frame.<init>(Frame.java:401)
at java.awt.Frame.<init>(Frame.java:366)
at javax.swing.SwingUtilities$1.<init>(SwingUtilities.java:1641)
at javax.swing.SwingUtilities.getSharedOwnerFrame(SwingUtilities.java:1637)
at javax.swing.JDialog.<init>(JDialog.java:211)
at test.JTestoraptor.UI.MessageBox.<init>(MessageBox.java:69)
at test.JTestoraptor.UI.ExceptionMessageBox.<init>(ExceptionMessageBox.java:
64)
at test.JTestoraptor.UI.ExceptionMessageBox.doExceptionMessageBox(ExceptionM
essageBox.java:152)
at test.JTestoraptor.Main.main(Main.java:121)
The classes MessageBox and ExceptionMessageBox extend the class JDialog. Does the headless support work also with swing classes? or this headless support works only for awt classes?
My main class extends JFrame so if the headless support doesn't work with swing classes, I was expecting to fail at the main class.
Again, any help will be very much appreciated,
Ward