B
bananenkasper
Gast
Hallo zusammen,
ich möchte die Equinox Umgebung programmatisch starten.
Dazu benutze ich folgenden Code:
Starte ich das Programm direkt aus Eclipse läuft es problemlos.
Wenn ich es allerdings als "Runnable JarFile" exportiere, und dann über die Console starte, bekomme ich eine NullPointerException:
ich möchte die Equinox Umgebung programmatisch starten.
Dazu benutze ich folgenden Code:
Java:
class EquinoxRunner {
private EquinoxRunner() {
}
public static BundleContext start(String path) throws Exception {
if (path != null)
setProperties(path);
return EclipseStarter.startup(new String[] { "-console", "-clean" },
null);
}
private static void setProperties(String path) throws IOException {
Properties properties = new Properties();
properties.load(new FileInputStream(new File(path)));
EclipseStarter.setInitialProperties(properties);
}
}
Starte ich das Programm direkt aus Eclipse läuft es problemlos.
Wenn ich es allerdings als "Runnable JarFile" exportiere, und dann über die Console starte, bekomme ich eine NullPointerException:
Code:
java.lang.NullPointerException
at java.io.File.<init>(File.java:277)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.getBundleContent(BaseStorage.java:656)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.createBundleFile(BaseStorage.java:665)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.createBundleFile(BaseAdaptor.java:466)
at org.eclipse.osgi.baseadaptor.BaseData.getBundleFile(BaseData.java:394)
at org.eclipse.osgi.baseadaptor.BaseData.getEntry0(BaseData.java:111)
at org.eclipse.osgi.baseadaptor.BaseData.getEntry(BaseData.java:102)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.getEntry0(AbstractBundle.java:1232)
at org.eclipse.osgi.framework.internal.core.Framework.findInSystemBundle(Framework.java:558)
at org.eclipse.osgi.framework.internal.core.Framework.findVMProfile(Framework.java:504)
at org.eclipse.osgi.framework.internal.core.Framework.loadVMProfile(Framework.java:420)
at org.eclipse.osgi.framework.internal.core.Framework.initialize(Framework.java:224)
at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:157)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:286)
at meinjarfile.starter.EquinoxRunner.start(EquinoxRunner.java:20)