我创建了一个非常简单的捆绑包:
public class Main implements BundleActivator, ServiceListener{
public void start(BundleContext bc) throws Exception {
bc.addServiceListener(this);
//trivial system out
System.out.println("started");
//output to file
FileWriter fw = new FileWriter("test.txt");
fw.write("it has worked");
fw.close();
//opening of a frame
JFrame f = new JFrame();
JLabel l = new JLabel("test");
f.add(l);
f.setVisible(true);
f.pack();
}
(other methods with empty body)
我已经编辑了清单文件:
Bundle-Name: Service listener example
Bundle-Description: A bundle that displays messages at startup and whe service events occur
Bundle-Vendor: Apache Felix
Bundle-Version: 1.0.0
Bundle-Activator: tosgi01.Main
Import-Package: org.osgi.framework
我已经把所有这些东西都打包了,启动了 felix 并:启动文件:testosgi.jar
它不会给出错误,但也不起作用。有没有办法获得有关正在发生的事情的一些详细信息?