Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 229400 - Bundle execution hangs in sun.awt.windows.WToolkit.initializeDesktopProperties()
Summary: Bundle execution hangs in sun.awt.windows.WToolkit.initializeDesktopProperties()
Status: RESOLVED DUPLICATE of bug 40066
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.3.2   Edit
Hardware: PC Windows XP
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: equinox.compendium-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-29 13:07 EDT by Byron Hawkins CLA
Modified: 2008-05-02 10:11 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Byron Hawkins CLA 2008-04-29 13:07:16 EDT
When a java.awt.Component is instantiated from within a bundle, and no java.awt.Component has yet been instantiated in the JVM, the calling thread hangs in method sun.awt.windows.WToolkit.initializeDesktopProperties()--even if the calling thread is the AWT event dispatch thread. The initializeDesktopProperties() method delegates to a native method that is never found in this execution context.

A simple workaround is to instantiate a javax.swing.JPanel before EclipseStarter.startup(), so that the main application thread initializes the WToolkit. The bundle will find the WToolkit initialized, and it will not try to call the problematic initializeDesktopProperties() method. 

At the very least, an exception should be thrown when an attempt is made to invoke an inaccessible native method in this context. It is very difficult to debug a hung thread within proprietary Sun binaries.
Comment 1 Byron Hawkins CLA 2008-05-01 16:24:08 EDT
It turns out this is only a problem when equinox is started with the "-console" option. The problem does not occur when the console is inactive. It would be nice to be able to use the console in a Swing/Equinox app, but it is really not much work to implement a Swing-compatible console.
Comment 2 Thomas Watson CLA 2008-05-02 08:56:07 EDT
I suspect this is a flavor of bug 40066.  Try setting the system property osgi.console.blockOnReady=true to work around.
Comment 3 Byron Hawkins CLA 2008-05-02 10:06:08 EDT
Thanks, Thomas, that solves it. The console and Swing are both working with this property.
Comment 4 Thomas Watson CLA 2008-05-02 10:11:46 EDT
Thanks for reporting back Byron.  I'm going to close this as a dup of bug 40066.

*** This bug has been marked as a duplicate of bug 40066 ***