Usage:
This option is only available on MacOS.
• -XstartOnFirstThread
Description:
The -XstartOnFirstThread option is only available on MacOS. Using this
option ensures that the main() method of the main Java class is executed on
the first thread of the process, i.e. the AppKit main UI thread.
This option is required when running applications that use the SWT library for
their user interface. This includes Eclipse and Eclipse Platform-based applications. It is also required for applicationst that use GWT.
This option is not required for applications that use AWT/Swing or JavaFX for
their UI, or for applications that do not have a graphical user interface.
Default Value:
-XstartOnFirstThread is off by default, i.e. the main() method may or may
not run on the first (AppKit) thread.
Errors:
If -XstartOnFirstThread is not used with an SWT based application, such as
Eclipse, then the following warning will be printed:
***WARNING: Display must be created on main thread due to Cocoa restrictions.
Exception in thread "main" org.eclipse.swt.SWTException: Invalid thread access
The application may still start but with limited or broken functionality.
Arguments Related to -XstartOnFirstThread:
TODO: link to -Xdock
Related Posts:
• Oracle article on bringing Java Applications to MacOS.
NOTE:
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.
Edit your Comment