[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] Re: Where is my JFrame? (was Strange behavior when trying to debug my application within eclipse)
|
- From: Alexandros Karypidis <akarypid@xxxxxxxx>
- Date: Tue, 20 Nov 2007 10:49:09 +0200
- Newsgroups: eclipse.platform
- Organization: EclipseCorner
- User-agent: Thunderbird 2.0.0.9 (Windows/20071031)
If you debug your application, you'll see that if you interrupt the main
thread you'll see it's within:
WDesktopProperties.init() line: not available [native method]
whereas the other thread is
FileInputStream.readBytes(byte[], int, int) line: not available
[native method]
My guess is that the Swing library somehow accesses the console in
WDesktopProperties.init() causing a deadlock. I'd use an object to wait
for the frame to become visible before proceeding with console access:
public void run() {
synchronized (sync) {
try {
sync.wait();
} catch (InterruptedException e) {
return;
}
}
// ...
and
private WhereIsMyJFrame() {
// ...
JFrame frame = new JFrame("WhereIsMyJFrame");
synchronized (sync) {
sync.notify();
}
System.out.println("main window created");
frame.setVisible(true);
Also, I'd guess that you could reproduce this thing outside of Eclipse
if you ran your program from the command line and redirected your
standard input and output.