8

I'm using the SWT browser widget to develop an application in Java with Eclipse ("Kepler").

Now I want to use the Mozilla API and downloaded the latest sdk from XULRunner from this site: http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/latest/

How can I tell Eclipse to use XULRunner so I can use the following code line?

browser = new Browser(shell, SWT.MOZILLA);

Any suggestions on the same are highly appreciated.

Nighty42
  • 420
  • 1
  • 6
  • 20
  • See http://www.eclipse.org/atf/old/downloads/base_files/manualXulrunner_section.php and http://stackoverflow.com/questions/295060/embedding-xulrunner-application-on-java. – Mihai8 Aug 01 '13 at 13:12
  • I followed the instructions on the first site but I got the following error: Could not parse application.ini. Then I found a thread on [stackoverflow](http://stackoverflow.com/questions/7567581/xulrunner-error-couldnt-parse-application-ini) where someone said, that it is not necessary to register it. So how can I tell Eclipse to use XULRunner? Comment to the 2nd link: I don't want to use another class which uses SWT and I think its not necessary to do so and change the existing classes I have embedded... – Nighty42 Aug 01 '13 at 13:32

2 Answers2

5

SWT is not supporting 'latest' XULRunner.
See Bug 327696 – [Browser] implement support for xulrunner >= 4.0

See also The SWT FAQ, Q: How do I specify the default type of native renderer that is used by the Browser? or Q: How do I explicitly use Mozilla as the Browser's underlying renderer? or so.

For example,

  1. Download the last one which is available on eclipse from http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/10.0.4esr/sdk/
  2. Extract it to C:\
  3. Edit your app's Run Configuration->Arguments->VM Arguments, add following argument. -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner
atlanto
  • 1,601
  • 1
  • 11
  • 10
  • Great - got it! Your example was very helpful :) You should only just add a "\bin" behind the given path cause it's a sdk: -Dorg.eclipse.swt.browser.XULRunnerPath=C:\xulrunner\bin – Nighty42 Aug 02 '13 at 07:32
  • How should I know which is `last one which is available on eclipse`? According to this bug report - https://bugs.eclipse.org/bugs/show_bug.cgi?id=422561 I tried 24.0b10... – Betlista Jun 28 '14 at 14:08
3

I'm using Eclipse Kepler on Debian Wheezy.

This is how I circunvented the trouble:

  1. Make sure you don't have any package named xulrunner:

    $ dpkg --list | fgrep xulrunner

  2. Install xulrunner-10.0 ( DO NOT install xulrunner-17.0 )

    $ apt-get install xul-runner-10.0

  3. Insert the following line in your eclipse.ini file:

    -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-10.0

  4. Restart Eclipse. It should pick up the new configuration and should work as expected.

Richard Gomes
  • 5,675
  • 2
  • 44
  • 50
  • 1
    Where do you find xulrunner-10.0? – greg Dec 22 '13 at 18:07
  • 1
    You can find all xulrunner releases [here](http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/). – Nobody Aug 08 '14 at 18:33
  • I've tried with an app based in Eclipse Kepler, to use http://ftp.mozilla.org/pub/mozilla.org/xulrunner/releases/10.0.4esr/runtimes/xulrunner-10.0.4esr.en-US.linux-x86_64.tar.bz2 , but the JVM crashes when trying to instantiate a Mozilla browser. Should I try version 10.0.0 instead of 10.0.4esr? – david.perez Dec 22 '14 at 09:54