RCP与SWT.Browser和XULRunner

时间:2011-10-25 14:38:18

标签: swt rcp xulrunner

我正在使用SWT.Browser( SWT.MOZILLA )开发RCP应用程序(Windows):

Browser browser = new Browser(parent, SWT.MOZILLA);

使用旧的XULRunner 3.6.23和描述的here安装工作正常:

xulrunner.exe --register-global

我想使用新的XULRunner 8.x,但正如前面提到的here,已经删除了安装XULRunner的方法。

所以我以编程方式添加了XULRunner-Path:

System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "Path\\To\\xulrunner_8.x"); 

但是当我启动我的应用程序时,我会收到以下错误

org.eclipse.swt.SWTError: XPCOM error -2147467261

那么将XULRunner 8.x与RCP应用程序嵌入并避免此错误的首选方法是什么?

4 个答案:

答案 0 :(得分:8)

Eclipse 3.8 / 4.2 M6开始,org.eclipse.swt.browser现在支持嵌入XULRunner 10.0.x,但您必须运送XULRunner 10运行时并按FAQ中所述明确指向它:

...    
    System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "path\to\xulrunner_10"); 
...

可以从ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/10.0/runtimes/

下载XULRunner 10运行时

JavaXPCOM的

Mozilla不再维护JavaXPCOM,而是Grant Gayed says

  

浏览器不需要JavaXPCOM才能使用它,它只是暴露   它想要通过其getWebBrowser()方法自己使用它的应用程序。

的Linux

由于Mozilla bug 720682,XULRunner 10目前无法在Linux下运行。

答案 1 :(得分:2)

对于Windows,您也可以使用Internet-Explorer作为浏览器,直到eclipse正确支持xulrunner(将在4.3.x版本中)。

对于IE:

只需指定

即可
    -Dorg.eclipse.swt.browser.DefaultType=ie,mozilla

eclipse.ini

您可以阅读更多相关信息here

答案 2 :(得分:0)

我在windows7(64位)上运行并拥有新的xulrunner vresion:31.0.0([http://wiki.mozilla-x86-64.com/Download][1]

但是当我试图给出一条道路时,它给了我错误 System.setProperty(" org.eclipse.swt.browser.XULRunnerPath"," path \ to \ xulrunner_31 \");

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.processCommandResult(MessagingInterface.java:342)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.syncSend(MessagingInterface.java:329)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.syncSend_(SWTNativeInterface.java:392)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface.syncSend(NativeInterface.java:104)
    at chrriis.dj.nativeswing.swtimpl.Message.syncSend(Message.java:64)
    at chrriis.dj.nativeswing.swtimpl.CommandMessage.syncExec(CommandMessage.java:55)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.runSync(SWTNativeComponent.java:201)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.createNativePeer(SWTNativeComponent.java:1009)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent.access$17(SWTNativeComponent.java:989)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$12.run(SWTNativeComponent.java:882)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:312)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:738)
    at java.awt.EventQueue.access$300(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:699)
    at java.awt.EventQueue$3.run(EventQueue.java:697)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:708)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeComponent$CMN_createControl.run(SWTNativeComponent.java:663)
    at chrriis.dj.nativeswing.swtimpl.CommandMessage.runCommand(CommandMessage.java:61)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface.runMessageCommand(NativeInterface.java:172)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.runMessageCommand(SWTNativeInterface.java:1429)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.runMessage(MessagingInterface.java:121)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.processReceivedMessages(MessagingInterface.java:106)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface.access$2(MessagingInterface.java:94)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface$2$2.run(MessagingInterface.java:442)
    at org.eclipse.swt.widgets.RunnableLock.run(Unknown Source)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Unknown Source)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Unknown Source)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface$OutProcess.runNativeSide(SWTNativeInterface.java:1352)
    at chrriis.dj.nativeswing.swtimpl.core.SWTNativeInterface.main_(SWTNativeInterface.java:1461)
    at chrriis.dj.nativeswing.swtimpl.NativeInterface.main(NativeInterface.java:224)
Caused by: org.eclipse.swt.SWTError: XPCOM error 0x80004005
    at org.eclipse.swt.browser.Mozilla.error(Unknown Source)
    at org.eclipse.swt.browser.Mozilla.initXULRunner(Unknown Source)
    at org.eclipse.swt.browser.Mozilla.create(Unknown Source)
    at org.eclipse.swt.browser.Browser.<init>(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.components.core.NativeWebBrowser.createControl(NativeWebBrowser.java:431)
    ... 19 more

没有它显示IE 9.0或另一个xulunner,我没有确认从哪里得到这个工作正常但显示firefox版本5.0。知道如何用最新的firefox版本更新。

答案 3 :(得分:0)

Eclipse_4.4.2现在支持XULRunner24.0,你可以尝试这个版本。