I am using Eclipse Cocao on Mac OS X 10.5.7, and the program hangs on the innocent line below while initializing variables. If I take it out, the program proceeds.
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
This line works fine in XP, Vista, Server 2003, and Mac OS X 10.4.11. I have no idea why it infinitely hangs now in 10.5. Any ideas?
Update: This appears to me to be a bug when using Cocoa Eclipse and Cocoa SWT. I can reproduce the example from Thorbjørn below without any problem. When I run the test program here though, I get the hanging behavior.
import java.awt.Dimension;
import org.eclipse.swt.widgets.Display;
public class Foo {
static Display display = new Display();
public Foo() {
Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
System.out.println(screenSize);
}
public static void main(String[] args) {
Foo test = new Foo();
}
}