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
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