Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Windowing and text-only

1 view
Skip to first unread message

Rob O'Connell

unread,
Jul 1, 1997, 3:00:00 AM7/1/97
to

I'm looking to develop an application that can run eitehr in text or GUI
mode.
The text mode is run in two cases:
1. User requests it on command line with a switch.
2. No access to Windowing system.

2. occurs in such cases as running on unix with no DISPLAY variable, or
it doesn't have rights to it.

I tried something like:
try {
frame.show();
}
catch(Exception e){ // HMM, doesn't catch windowing error!
// attempt to catch error when text-only terminal
System.out.println("Can't open window- reverting to text mode");
textOnly=true;
}

in the hopes that when it throws any exception (I wasn't sure which to
expect)
I could catch it.

Unfortunately, it doesn't throw an exception, instead it has some
internal error:
_X11TransSocketUNIXConnect: Can't connect: errno = 111
java.lang.InternalError: Can't connect to X11 window server using ':0.0'
as the value o
f the DISPLAY variable.
at sun.awt.motif.MToolkit.<init>(MToolkit.java:48)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:244)
at java.awt.Window.getToolkit(Window.java:199)
at java.awt.Frame.addNotify(Frame.java:139)
at java.awt.Window.show(Window.java:132)
at Chat.init(Chat.java:137)
at Chat.<init>(Chat.java:92)
at Chat.main(Chat.java:84)

Any ideas on how to handle this without the program just crashing?

Thanks,
Rob


Nicholas Paldino

unread,
Jul 1, 1997, 3:00:00 AM7/1/97
to Rob O'Connell

Rob O'Connell,

Catch the Error, not the Exception. Errors are not meant to be
caught, but they can be if needed.

- Nicholas Paldino
- cas...@cs.albany.edu

0 new messages