i'm trying use firefox swt browser runs inside eclipse rcp plugin.
i've tried loading xulrunner using following code 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 , eclipse indigo. have tried xulrunner 3.6.25 , 10. firefox version used 10 , 22.
no matter version, crashes giving stacktrace:
org.eclipse.swt.swterror: xpcom error -2147467259 @ org.eclipse.swt.browser.mozilla.error(mozilla.java:2502) @ org.eclipse.swt.browser.mozilla.initxulrunner(mozilla.java:2464) @ org.eclipse.swt.browser.mozilla.create(mozilla.java:672) @ org.eclipse.swt.browser.browser.<init>(browser.java:99)
if remove file:///
before path xulrunner error c not registered protocol
in xulrunner 3.6.25.
does know particular xpcom error means , how fix it?
building on this answer, these steps made firefox work me inside eclipse:
- install ajax tools framework (http://wiki.eclipse.org/atf/installing)
- under "run configurations..." -> "plug-ins" add
org.mozilla.xulrunner
,org.mozilla.xulrunner.win32.win32.x86
start firefox within swt.browser using following code:
bundle bundle = platform.getbundle("org.mozilla.xulrunner"); //$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.defaulttype", "mozilla"); system.setproperty( "org.eclipse.swt.browser.xulrunnerpath", file.getabsolutepath()); //$non-nls-1$ } catch (ioexception e) { e.printstacktrace(); } catch (urisyntaxexception e) { e.printstacktrace(); } } } else { system.err.println("could not find xulrunner bundle"); } browser webbrowser = new browser(parent, swt.mozilla); griddata grid = new griddata(griddata.fill_both); webbrowser.setlayoutdata(grid); // prepending "file://" prevents "<driveletter> not registered protocol" error string graphurl = "file://c:/users/you/yourgraph.html" webbrowser.seturl(graphurl);
Comments
Post a Comment