-
Bug
-
Resolution: Not an Issue
-
P3
-
8, 11, 17, 18
-
x86_64
-
os_x
ADDITIONAL SYSTEM INFORMATION :
OS X Monterey 12.4, 32 gig iMac i7, OpenJDK 18.0.1.1
A DESCRIPTION OF THE PROBLEM :
This seems to be a regression from bug #7128597. When building an app that uses AWT/Swing, if you use the -XstartOnFirstThread VM switch then it either locks or never shows a window. This fails either creating a Frame directly in a main or within an invokeLater.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use this simple code (with or without the invokeLater, it doesn't make a difference, probably easier to check otherwise but I added this to test if that would be a fix):
package com.mycompany.testproject;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class TestProject {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame=new JFrame();
frame.setMinimumSize(new Dimension(1000, 500));
frame.setVisible(true);
});
}
}
Add VM option -XstartOnFirstThread
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You should get a single frame.
ACTUAL -
Nothing happens. Removing the -XstartOnFirstThread gets you the expected results.
---------- BEGIN SOURCE ----------
public class TestProject {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame=new JFrame();
frame.setMinimumSize(new Dimension(1000, 500));
frame.setVisible(true);
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Removing -XstartOnFirstThread, but this isn't possible as libraries I'm using require it.
FREQUENCY : always
OS X Monterey 12.4, 32 gig iMac i7, OpenJDK 18.0.1.1
A DESCRIPTION OF THE PROBLEM :
This seems to be a regression from bug #7128597. When building an app that uses AWT/Swing, if you use the -XstartOnFirstThread VM switch then it either locks or never shows a window. This fails either creating a Frame directly in a main or within an invokeLater.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Use this simple code (with or without the invokeLater, it doesn't make a difference, probably easier to check otherwise but I added this to test if that would be a fix):
package com.mycompany.testproject;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class TestProject {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame=new JFrame();
frame.setMinimumSize(new Dimension(1000, 500));
frame.setVisible(true);
});
}
}
Add VM option -XstartOnFirstThread
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
You should get a single frame.
ACTUAL -
Nothing happens. Removing the -XstartOnFirstThread gets you the expected results.
---------- BEGIN SOURCE ----------
public class TestProject {
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
JFrame frame=new JFrame();
frame.setMinimumSize(new Dimension(1000, 500));
frame.setVisible(true);
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Removing -XstartOnFirstThread, but this isn't possible as libraries I'm using require it.
FREQUENCY : always
- relates to
-
JDK-7128597 [macosx] Program freeze when Swing is used with -XstartOnFirstThread
-
- Closed
-