Greetings.
I'm having serious issues in having JFrames declared inside the Activator class or any class used in a service!!!
When i try to start the bundle, there's always an error like this (an example):
"Error executing commang: Activator start error in bundle swing_osgi [183]."
swing_osgi is the bundle and 183 is the ID.
What's the problem????
package pack.server; import java.util.Dictionary; import java.util.Hashtable; import javax.swing.JFrame; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceRegistration; import pack.iserver.IServer; public class Activator implements BundleActivator { private ServiceRegistration registration; private JFrame f = null; public void start(BundleContext context) throws Exception { Dictionary<String, String> props = new Hashtable<String, String>(); javax.swing.SwingUtilities.invokeLater(new Runnable() { // This creates of the application window. public void run() { System.out.println("hey"); f = new JFrame(); f.setVisible(true); } }); // Console c = new Console(); // c.setSystemInput(); // c.setSystemOutput(); // c.setSystemErr(); registration = context.registerService(IServer.class.getName(), new Server(), props); System.out.println("O servidor foi registado"); // String[] keys = registration.getReference().getPropertyKeys(); // // for(String k: keys){ // System.out.println(k); // } } public void stop(BundleContext context) throws Exception { registration.unregister(); } }
strange thing is that "hey" isn't even printed.... wtf
I even tried without using the invokeLater method and causes to happen the same.