1

I'm trying to run the Enhanced JavaScript Bridge example found here.

I created a new project, and added a reference to SWT via:

Project(right-click)-->Properties-->Libraries-->Add Variable-->Configure Variable-->New

However I cannot get this project to run. The error I get depends on what SWT library I'm referencing:

  • org.eclipse.swt.win32.win32.x86_64_3.103.2.v20150203-1351.jar: Error is

Could not instantiate Browser: org.eclipse.swt.internal.mozilla.init.XPCOMInit.GREVersionRange_sizeof()I

  • swt-3.6.1-win32-win32-x86_64\swt.jar: Error is

Could not instantiate Browser: No more handles [Could not detect registered XULRunner to use]

It seems I am having a problem with XULRunner or the Mozilla browser. I tried using different XULRunner versions (10, 18, 24) by running xulrunner.exe --register-global in the console in their respective folders. It didn't help. I don't know what else to do.

My system is:

  • Windows 7 64-bit
  • Eclipse Luna 4.4.2
sangil
  • 1,310
  • 2
  • 18
  • 25
  • I've been investigating this during the last 3 hours and I think it can be related with us using Firefox in 32-bit, but I don't know for sure. @sangil, did you manage to get it working? It is important for me. – Chexpir May 07 '15 at 17:23
  • @Chexpir - see below – sangil May 10 '15 at 08:53

1 Answers1

1

Ok, so I managed to get XULRunner working in the following way:

1) Download XULrunner 24.0. You can find the versions I used here:

2) In my Java code I create a Composite to contain my Browser object.

In its constructor I set the path to the xulrunner folder I downloaded in step 1, and then instantiate the browser:

public class MyBrowserComp extends Composite {

    private String pathToXulrunner = "C:\\path\\to\\xulrunner";`

    private Browser browser;

    public MyBrowserComp(..) {
        System.setProperty("org.eclipse.swt.browser.XULRunnerPath", pathToXulrunner);
        browser = new Browser(this, SWT.MOZILLA);
    }
}
sangil
  • 1,310
  • 2
  • 18
  • 25