OS X + Swing + OSGi [message #725514] |
Thu, 15 September 2011 03:18 |
justin Messages: 4 Registered: September 2011 |
Junior Member |
|
|
Hello,
I am trying to develop OSGi bundles that use Swing. I would like to use Eclipse for this, as I find the built-in equinox framework is great for testing purposes. However, I run into a problem when using Mac OS X (currently 10.7) and Java 1.6 with Eclipse 3.7 Cocoa 64-bit.
When I run using an OSGi Framework configuration, I get the following console output:
osgi> 2011-09-14 23:11:08.137 java[1801:407] [Java CocoaComponent compatibility mode]: Enabled
2011-09-14 23:11:08.137 java[1801:407] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
The JFrame will appear behind Eclipse and I can not focus it. This is a huge problem as I need focus for listening to mouse/keyboard events.
After many hours of searching Google and looking at a couple Eclipse bug reports, I tried the following:
1. Removing "-ws ${target.ws}" from the program arguments in the launch configuration.
2. Adding "--launcher.secondThread" to the program arguments in the launch configuration.
3. Modifying the eclipse.ini to remove any reference to "-XstartOnFirstThread"
4. Adding "--launcher.secondThread" to eclipse.ini
By doing #1, the error message no longer appears but the JFrame fails to launch. In fact, I believe the bundle is stuck in "Starting" and never "Active".
So far, the only solution I have is to use the 32-bit Cocoa version of Eclipse.
This is a really frustrating issue, and for now I will use 32-bit Eclipse for this particular program, but I am hoping there is a better solution.
public class Activator implements BundleActivator {
public void start(BundleContext context) throws Exception {
JFrame f = new JFrame("Hello World");
f.setSize(300,300);
f.setVisible(true);
}
public void stop(BundleContext context) throws Exception {}
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.02828 seconds