我想让SWT 4.4.2浏览器在Linux(Ubuntu 14.o4 LTS)上使用Mozilla,每当我运行我的应用程序SWT使用webkit。 任何想法如何让SWT使用Mozilla?
作为一个例子,我正在使用SWT的以下代码来打开embedded式浏览器。 Linux的Ubuntu版本
public class DisplayMozillaVersion { public static void main(String[] args) { Device.DEBUG = true; Display display = new Display(); Shell shell = new Shell(display); System.out.println(">>>Snippet creating SWT.MOZILLA-style Browser"); try { new Browser(shell, SWT.MOZILLA); System.out.println(">>>succeeded"); } catch (Error e) { System.out.println(">>>This failed with the following error:"); e.printStackTrace(); System.out.println("\n\nSnippet creating SWT.NONE-style Browser"); try { new Browser(shell, SWT.NONE); System.out.println(">>>succeeded"); } catch (Error e2) { System.out.println(">>>This failed too, with the following error:"); e2.printStackTrace(); } } display.dispose(); } }
上面的代码总是失败的Mozilla( SWT.MOZILLA
),并提供以下错误
没有更多的句柄[GTK 3不支持浏览器风格SWT.MOZILLA和Java系统属性org.eclipse.swt.browser.DefaultType = mozilla,因为XULRunner尚未移植到GTK 3] 在org.eclipse.swt.SWT.error(未知来源) 在org.eclipse.swt.browser.MozillaDelegate。(未知来源) 在org.eclipse.swt.browser.Mozilla.create(未知来源) 在org.eclipse.swt.browser.Browser。(未知来源) 在swtbrowserapp.SWTBrowserApp。(SWTBrowserApp.java:72) 在swtbrowserapp.SWTBrowserApp.main(SWTBrowserApp.java:38)
当我使用SWT.NONE
它总是使用WebKit。 在Ubuntu 14.04 LTS上运行Mozilla作为SWT浏览器的方式是什么?
Eclipse 4.4.2 Swt Browser与Xulrunner 10和24一起工作(xulrunner是Mozilla Firefox的底层渲染引擎)。 你需要从xulrunner下载下载
Ubuntu 14.04上的Eclipse 4.4.2默认运行在gtk2上(这个在4.5及以上版本中有所变化)。 所以没有需要改变。
您可以将以下开关添加到eclipse.ini中
-Dorg.eclipse.swt.browser.DefaultType=mozilla -Dorg.eclipse.swt.browser.XULRunnerPath=<path to xulrunner libs>
这应该将eclipse设置为使用xulrunner渲染引擎