iA


JRex embedded browser

by Vijay Kiran

Today I started working on JRex, and embeddable Gecko(Mozilla) browser for Java. I spent almost 3 hours to get JRexworking on my machine. I followed all the steps in the releases page.

And when I try to run the program here’s the error I got

GetNativeWindowPointer()-->
     **** Inside *********** ThrowJRexException msg

    Could not get JAWT, is component HEADLESS ?>
    status <0> **************
    JRex_ThrowByName nameorg/mozilla/jrex/exception/JRexException
     msg GetNativeWindowPointer()-->Could not get JAWT, is component HEADLESS ?
     [NS-ERROR<0x0L>] *******
........

After 3 hours of debugging, searching through the mailing lists, google, I couldn’t find the any solution. Here’s the code I was using to create the JRex embedded in a JFrame.

import javax.swing.JFrame;
 
import org.mozilla.jrex.JRexFactory;
import org.mozilla.jrex.exception.JRexException;
import org.mozilla.jrex.ui.JRexCanvas;
import org.mozilla.jrex.window.JRexWindowManager;
 
public class TestJRex {
	public static void main(String[] args) throws JRexException {
		System.setProperty("jrex.gre.path",
				"c:/jrex08092005/jrex_gre/org/mozilla/jrex/jrex_gre");
 
		JFrame frame = new JFrame();
		frame.setVisible(true);
 
		JRexWindowManager winManager;
		JRexCanvas browser;
 
		JRexFactory.getInstance().startEngine();
		winManager = (JRexWindowManager) JRexFactory.getInstance()
				.getImplInstance(JRexFactory.WINDOW_MANAGER);
		winManager.create(JRexWindowManager.TAB_MODE);
		winManager.init(frame.getRootPane());
		browser = (JRexCanvas)
                 winManager.getBrowserForRootParent(frame.getRootPane()).next();
		// winManager.addJRexWindowListener(this);
 
 
	}
}

And finally, here is the solution:


Eclipse was configured to use the JDK to run the java programs. But running JRex requires jre path instead of JDK directory. So I’d to change the Installed JRE’s in Eclipse to create a new JRE that points to the JRE directory instead of the JDK directory, and I set that one as the default JRE. That’s it, it solved the problem.



  • http://www.algirdas.com Anonymous

    Greate topic. I spent over 1 day trying to run JRex until I found your blog. Greate job vijaykiran. Thank you.

  • SivaPatnani

    When i try to run a example,throw exception?
    ***************** JRexL inited *****************
    ***************** JREX-Logging disabled *****************
    Exception in thread “main” org.mozilla.jrex.exception.JRexException
    at org.mozilla.jrex.xpcom.JRexXPCOMImpl.startXPCOM(JRexXPCOMImpl.java:143)
    at org.mozilla.jrex.JRexFactory.startEngine(JRexFactory.java:222)
    at TestJRex.main(TestJRex.java:19)
    Caused by: java.lang.UnsatisfiedLinkError: org.mozilla.jrex.xpcom.JRexXPCOMImpl.InitXPCOM(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
    at org.mozilla.jrex.xpcom.JRexXPCOMImpl.InitXPCOM(Native Method)
    at org.mozilla.jrex.xpcom.JRexXPCOMImpl.access$200(JRexXPCOMImpl.java:45)
    at org.mozilla.jrex.xpcom.JRexXPCOMImpl$1.run(JRexXPCOMImpl.java:172)

  • lutz

    does anyone have a solution to this problem? cause i get exactly the same error!

  • Rick Wong

    Thank you very much for posting this solution.

  • Marcio

    Hi, did you get to solve this problem? I get the same exception here… Please, let me know of any updates.
    Regards,
    Marcio Lima.
    marcioferlan@hotmail.com