RuntimeException with XPCom.initXPCOM(...) from JavaConnect

Murilo Camões Perrone <[email protected]>
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <[email protected]>
Help !

How should I initialize Javaconnect from within a Java code of a XPCom component ?

My initialization code is:
     
     System.out.println("Loading javaxpcom.dll..");
     System.loadLibrary("javaxpcom");
     
     String mozillaPath = "c:/arquiv~1/mozill~1";
     java.io.File localFile = new java.io.File( mozillaPath );
     //XPCOM.initXPCOM(localFile, null);
     GeckoEmbed.initEmbedding(localFile, null);

I tried to follow the same way the JavaConnect test files do it, but I am receiving an RuntimeException, either using XPCOM and GeckoEmbed init methods.
I tried setting and reading a system variable for mozilla path (System.getProperty("MOZILLA_HOME");), but it was not recognized.

I am using LiveConnect, from Java Firefox Extension skeleton. I hope this won´t matter.

Curiously, after running the same java routine for a second time, the initialization method works, but then I get another RuntimeException at the next java commands:

  nsIComponentManager compMgr = XPCOM.getComponentManager();
  nsIChromeRegistry chromeRegistry = (nsIChromeRegistry)
   compMgr.createInstance( "mozilla.org/chrome/chrome-registry;1", null, nsIChromeRegistry.NS_ICHROMEREGISTRY_IID );

RuntimeException: The function "createInstance" returned an error condition  (0x80040154 = NS_ERROR_FACTORY_NOT_REGISTERED)

Any suggestions ?
------
Murilo Perrone
CertiSign
smime.p7s (application/x-pkcs7-signature, 3.9 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.