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

后端 未结 4 1710
情话喂你
情话喂你 2020-12-25 08:46

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.

Howeve

4条回答
  •  萌比男神i
    2020-12-25 09:29

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

    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/lib and /usr/lib/jni is 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-jni and org.eclipse.swt.browser.UseWebKitGTK system property is set to `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();
    
        }
    }
    

提交回复
热议问题