public void launch() throws CoreException{
DerbyPlugin plugin = DerbyPlugin.getDefault();
// constructs a classpath from the default JRE...
IPath systemLibs = new Path(JavaRuntime.JRE_CONTAINER);
IRuntimeClasspathEntry systemLibsEntry = JavaRuntime.newRuntimeContainerClasspathEntry(
systemLibs, IRuntimeClasspathEntry.STANDARD_CLASSES);
systemLibsEntry.setClasspathProperty(IRuntimeClasspathEntry.BOOTSTRAP_CLASSES);
//include org.apache.derby.core plugin
IRuntimeClasspathEntry derbyCPEntry = null;
List classpath = new ArrayList();
classpath.add(systemLibsEntry.getMemento());
try {
ManifestElement[] elements_core, elements_ui;
elements_core = getElements(CommonNames.CORE_PATH);
elements_ui=getElements(CommonNames.UI_PATH);
Bundle bundle;
URL pluginURL,jarURL,localURL;
bundle=Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for(int i=0;i<elements_core.length;i++){
if(!elements_core[i].getValue().toLowerCase().endsWith("derbynet.jar")){
jarURL= new URL(pluginURL,elements_core[i].getValue());
localURL=Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
bundle=Platform.getBundle(CommonNames.CORE_PATH);
pluginURL = bundle.getEntry("/");
for(int i=0;i<elements_ui.length;i++){
if(!elements_ui[i].getValue().toLowerCase().equals("ui.jar")){
jarURL= new URL(pluginURL,elements_ui[i].getValue());
localURL=Platform.asLocalURL(jarURL);
derbyCPEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(localURL.getPath()));
derbyCPEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES);
classpath.add(derbyCPEntry.getMemento());
}
}
}
catch(Exception e) {
e.printStackTrace();