Linux 如何使用 Webkit 在 Ubuntu 11.04 (Natty Narwhal) 上运行 Eclipse SWT 浏览器组件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5817263/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 03:50:41  来源:igfitidea点击:

How to get Eclipse SWT Browser component running on Ubuntu 11.04 (Natty Narwhal) with Webkit?

linuxeclipsegtkswt

提问by Phillipus

I use the SWT Browser control in my Eclipse RCP application. On Linux Ubuntu 10.10 this depends on the user having installed xulrunner-1.9.2. This works fine.

我在 Eclipse RCP 应用程序中使用了 SWT 浏览器控件。在 Linux Ubuntu 10.10 上,这取决于安装了 xulrunner-1.9.2 的用户。这工作正常。

However, on Ubuntu 11.04 I find that it ships by default with xulrunner-2.0. The SWT Browser does not support this. See http://bugs.eclipse.org/bugs/show_bug.cgi?id=327696and http://bugs.eclipse.org/bugs/process_bug.cgi

但是,在 Ubuntu 11.04 上,我发现它默认随 xulrunner-2.0 一起提供。SWT 浏览器不支持这一点。请参阅http://bugs.eclipse.org/bugs/show_bug.cgi?id=327696http://bugs.eclipse.org/bugs/process_bug.cgi

So rather than ask the user to install xulrunner-1.9.2 I want to get the SWT Browser to run with WebKitGTK as per the instructions on the SWT FAQ - http://www.eclipse.org/swt/faq.php#browserwebkitgtk

因此,与其要求用户安装 xulrunner-1.9.2,不如按照 SWT FAQ - http://www.eclipse.org/swt/faq.php#browserwebkitgtk上的说明让 SWT 浏览器与 WebKitGTK 一起运行

I cannot get this to work at all. How do I fulfil "WebKitGTK 1.2.0 or newer must be in the library load path"?

我根本无法让它发挥作用。如何实现“WebKitGTK 1.2.0 或更新版本必须在库加载路径中”?

Any help much appreciated

非常感谢任何帮助

采纳答案by barti_ddu

I'm not on Ubuntu, but think that doesn't matter much.

我不在 Ubuntu 上,但认为这无关紧要。

  1. Check the version of libwebkit-1.0-2(it should be >= 1.2.0)
  2. Install this package if absent
  3. Check that /usr/liband /usr/lib/jniis in java.library.path
  4. If you use SWT 3.6, also check that appropriate webkit jni wrapper is installed (e.g. libswt-webkit-gtk-3.6-jniand org.eclipse.swt.browser.UseWebKitGTKsystem property is set to `True
  1. 检查版本libwebkit-1.0-2(它应该是>= 1.2.0)
  2. 如果没有安装这个包
  3. 检查/usr/lib/usr/lib/jnijava.library.path
  4. 如果您使用 SWT 3.6,还要检查是否安装了适当的 webkit jni 包装器(例如libswt-webkit-gtk-3.6-jniorg.eclipse.swt.browser.UseWebKitGTK系统属性设置为 `True

Edit:To localize source of the problem create minimalistic project and show the output

编辑:要本地化问题的根源,请创建简约项目并显示输出

package foo;

import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class BrowserTest {

    public static void main(String[] args) {

        System.out.println(System.getProperty("java.library.path"));
        System.out.println(System.getProperty("org.eclipse.swt.browser.UseWebKitGTK"));

        Display display = new Display();
        Shell shell = new Shell(display);

        try {
            Browser browser = new Browser(shell, SWT.NONE);
            browser.setSize(shell.getSize());
            browser.setUrl("google.com");
        } catch (SWTError e) {
            e.printStackTrace();
        }

        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();

    }
}

回答by ihadanny

For Natty, check out this page: http://www.maplef.net/blog/archives/ubuntu-upgrade-eclipse3-5-to-3-6.html(ignore japanses/chinese stuff, just follow the code to reach shangri-la)

对于 Natty,请查看此页面:http: //www.maplef.net/blog/archives/ubuntu-upgrade-eclipse3-5-to-3-6.html(忽略日语/中文内容,只需按照代码即可到达香格里拉)

回答by vorburger

Simply installing the "hotot" (Twitter) App via Software Center, which drags WebKit along, did the trick for me. - A "sudo apt-get install -y libwebkitgtk-1.0-0", or build from source as per https://help.ubuntu.com/community/WebKit, would probably work as well.

只需通过软件中心安装“hotot”(Twitter)应用程序,它就会拖着 WebKit,对我来说就成功了。- “sudo apt-get install -y libwebkitgtk-1.0-0”,或按照https://help.ubuntu.com/community/WebKit从源代码构建,可能也能工作。

回答by Chris Owens

For Eclipse Juno SR1 (4.2 SR1) running on Ubuntu 12.04, the following worked for me:

对于在 Ubuntu 12.04 上运行的 Eclipse Juno SR1 (4.2 SR1),以下对我有用:

  1. Install the libwebkit package: sudo apt-get install libwebkitgtk-3.0-0
  2. Install the libwebkit jni wrapper: sudo apt-get install libswt-webkit-gtk-3-jni
  3. Set the DefaultType and UseWebKitGTK properties (I did it by adding the following to my eclipse.ini file):

     -Dorg.eclipse.swt.browser.DefaultType=webkit
     -Dorg.eclipse.swt.browser.UseWebKitGTK=true
    
  1. 安装 libwebkit 包: sudo apt-get install libwebkitgtk-3.0-0
  2. 安装 libwebkit jni 包装器: sudo apt-get install libswt-webkit-gtk-3-jni
  3. 设置 DefaultType 和 UseWebKitGTK 属性(我通过将以下内容添加到我的 eclipse.ini 文件中来做到的):

     -Dorg.eclipse.swt.browser.DefaultType=webkit
     -Dorg.eclipse.swt.browser.UseWebKitGTK=true