I'm trying to use Firefox as my SWT Browser that runs inside my Eclipse RCP plugin.
I've tried loading XULRunner using the following code which I found here:
Bundle bundle = Platform.getBundle(PLUGIN_NAME); //$NON-NLS-1$
if (bundle != null) {
URL resourceUrl = bundle.getResource("xulrunner"); //$NON-NLS-1$
if (resourceUrl != null) {
try {
URL fileUrl = FileLocator.toFileURL(resourceUrl);
File file = new File(fileUrl.toURI());
System.setProperty(
"org.eclipse.swt.browser.XULRunnerPath", "file:///" + file.getAbsolutePath()); //$NON-NLS-1$
System.setProperty("org.eclipse.swt.browser.DefaultType",
"mozilla");
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
}
}
Browser webBrowser = new Browser(parent, SWT.MOZILLA);
I'm using Windows 7 x86 and Eclipse Indigo. I have tried XULrunner 3.6.25 and 10. The Firefox version I used were 10 and 22.
No matter what version, it crashes giving this stacktrace:
org.eclipse.swt.SWTError: XPCOM error -2147467259
at org.eclipse.swt.browser.Mozilla.error(Mozilla.java:2502)
at org.eclipse.swt.browser.Mozilla.initXULRunner(Mozilla.java:2464)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:672)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:99)
If I remove the file:///
before the path to XULRunner I get the error c is not a registered protocol
in XULrunner 3.6.25.
Does anybody know what this particular XPCOM error means and how to fix it?