Tuesday, January 11, 2011

JRex, Embedding Gecko (Firefox) in eclipse

Jrex is a Java component that embeds Mozila Gecko in your application. The project has been dead for some time since 2008 from what the mozdev.org page. So the version of Gecko may not be the latest but should be good enough for whatever you would like to try out.

 However looking at the code from Vijay (http://www.vijaykiran.com/2006/09/05/using-jrex-in-eclipse-rcp/
), i got it working and it seems to work fine, but Vijay dosen't really go into how to setup the project like where to download the jars and where to put the dll and so on, and I did have some hard time trying to find out where to find the jars.

1. At first i took apart the jnlp file on jrex.mozdev.org to find out what are the dependencies, but after looking around the mozdev site, i finally found the downloads for the jars, source and docs in here (http://www.mozdev.org/source/browse/jrex/downloads/#dirlist).

 2. But it dosen't include the jrex_gre files that are in the jnlp, those you can get them here (http://www.mozdev.org/source/browse/jrex/www/releases/jrex-1.0b1_dom3/). Look for the jrex_gre.jar

 Setting up your eclipse.
Put the jrex.dll in your eclipse directory, if not you will get a UnsatisfiedLinkError when you try to run the view. Put the jrex.jar in your lib folder of your project.

 Unzip the jrex_gre.jar contents to a nice location you can remember.  You will see in Vijay's code a place that you will need to supply the path to the file in org/mozilla/jrex/jrex_gre files.

 That should fill up the missing pieces in Vijay's writeup.

I will try to package the source code into github at some later time.
&n bsp;