I started writing a simple Hello world app with JFrame
, and I noticed that the first window that I create (or the first reference to Swing libraries) takes 15 seconds to show. I also tested it with the compiled application launched from console to see if there is a difference, and there is none.
Here's my code:
public static void main(String args[]) {
/* Create and display the form */
SwingUtilities.invokeLater(new Runnable() {
public void run() {
long start = System.currentTimeMillis();
new Test().setVisible(true);
System.out.println("FORM 1: " + (System.currentTimeMillis() - start));
start = System.currentTimeMillis();
new Test2().setVisible(true);
System.out.println("FORM 2: " + (System.currentTimeMillis() - start));
}
});
}
And here's output:
FORM 1: 15362
FORM 2: 203
I've read about disabling D3D for Java2D but it's no use for me as I work on linux (openSUSE). I also tried switching from Oracle's JDK 1.8 to openJDK 1.8 but it still doesn't make any difference.
What can I do to speed that thing up?