SWT Browser not working?

拟墨画扇 提交于 2019-12-04 04:00:20

问题


I'm having a little trouble with the SWT Browser component. I am running Ubuntu 11.04 AMD64 and Eclipse 3.7, with Java SE 1.6 from Sun

My problem is that my browser won't initialize. When I make it with the SWT.NONE flag, I get errors

Exception in thread "main" org.eclipse.swt.SWTError: No more handles (java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file)
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.SWT.error(SWT.java:3481)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:324)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)

Caused by: java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:219)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:151)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:309)
... 3 more

And then when I try to use the SWT.MOZILLA flag, I get

Exception in thread "main" org.eclipse.swt.SWTError: No more handles [Could not detect registered XULRunner to use]
at org.eclipse.swt.SWT.error(SWT.java:3589)
at org.eclipse.swt.browser.Mozilla.create(Mozilla.java:280)
at org.eclipse.swt.browser.Browser.<init>(Browser.java:109)
at browser.Main.createGUI(Main.java:40)
at browser.Main.main(Main.java:21)

I suspect this is partly because I am using XULRunner2, but I would prefer to use WebKit, which in Eclipse 3.7 (that's why I upgraded), should be default when using SWT.NONE.

If any of you have run into this problem and/or have solved it before, I would appreciate it if you could help me.

Thanks!


回答1:


According to SWT FAQ you may have unsupported XULRunner2 (try older versions). You should also check if you have installed WebKitGTK+ 1.2.x for WebKit browser core.

EDIT

Edited based on your comments. Accordingly to this FAQ you should have WebKitGTK 1.2.0 or newer in the library load path, so check if you have.. And create browser with SWT.NONE..

The error message you get from SWT said so you don't have the library on the path you should java.lang.UnsatisfiedLinkError: no swt-mozilla-gtk-3346 or swt-mozilla-gtk in swt.library.path, java.library.path or the jar file



来源:https://stackoverflow.com/questions/6418568/swt-browser-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!