Hello,
The following code shows you an example of bundle installation and starting.
- loc is the path of the bundle (URL)
- context is the bundle context
out.println("Installing " + loc + "...");
Bundle bundle = null;
try {
bundle = context.installBundle(loc);
out.println(loc + " is installed as " + bundle.getBundleId());
} catch (BundleException e) {
err.println("Failed to install " + loc + " : " +
e.getMessage());
return;
}
if(!installOnly) {
out.println("Starting " + loc + "...");
try {
bundle.start();
} catch (BundleException e) {
err.println("Failed to start bundle " +
bundle.getBundleId() + " : " + e.getMessage());
return;
}
}
Clement