Exception in thread "main" org.eclipse.swt.SWTError: XPCOM error 0x80004005 in swt.mozilla

following my SWT code that uses the Mozilla browser, but it gives me the xpcomm error 0x80004005 error.

import java.awt.GridLayout;
import java.io.File;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.internal.dnd.SwtUtil;

public class Newbrowser {
    public static void main(String a[]) {
        Display display = new Display();
        Shell shell = new Shell(display);
        /* Composite controls = new Composite(shell, SWT.NONE); */
        shell.setText("Browser");
        String pathToXulrunner = "C://Program Files (x86)/Mozilla XULRunner/";

        System.setProperty("org.eclipse.swt.browser.XULRunnerPath", pathToXulrunner);

        /*
         * System.setProperty("org.eclipse.swt.browser.XULRunnerPath",
         * pathToXulrunner);
         */
        System.setProperty("org.eclipse.swt.browser.MOZ_PROFILE_PATH", new File("").getAbsolutePath());
        Browser browser = new Browser(shell, SWT.MOZILLA);
        shell.setLayout(new FillLayout());
        shell.open();

        FormData data = new FormData();

        data.top = new FormAttachment(0, 0);
        data.bottom = new FormAttachment(100, 0);
        data.left = new FormAttachment(0, 0);
        data.right = new FormAttachment(100, 0);
        browser.setLayoutData(data);
        browser.setUrl("www.google.com");

        // Set up the event loop.

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                // If no more entries in the event queue
                display.sleep();
            }
        }
        display.dispose();
    }
}

Please help me solve this problem. thanks in advance.

0
source share
1 answer

From the notes on using XULRunner here , it seems that using version 10.x is correct.

I managed to run your code by downloading XULRunner 10.0.4esr . I followed the installation steps mentioned in this answer and also pointed to the directory bin.

  • Download xulrunner-10.0.4esr.en-US.win32.sdk.zip from this directory
  • xulrunner - ( c:/xulrunner, C:/Program Files (x86)/XULRunner .
  • VM (-Dorg.eclipse.swt.browser.XULRunnerPath) System.setProperty(), . , bin, xulrunner.

, XULRunner ( SDK), , , , . , , :

String pathToXulrunner = "C://Program Files (x86)/Mozilla XULRunner/";

:

String pathToXulrunner = "C:/Program Files (x86)/Mozilla XULRunner/bin";

64- Windows 10 SWT 4.5.2, .


: , 32- (32- Java 32- SWT). , 32- , . XULRunner 24 64- JRE, .


2: 64- bin xulrunner-1.9.2.25 : https://osdn.net/projects/sfnet_runawfe/downloads/SRC%20and%20BIN%20files/extras/xulrunner-1.9.2.25-win64.zip/

. , bin ( SDK), bin pathToXulrunner.

, - .


3: xulrunner-1.9.2.25.en-US.win64.zip

0

All Articles