Re: about xpcommexception

Javier Pedemonte <[email protected]>
Newsgroups gmane.comp.mozilla.devel.java
Message-ID <Obednb7NO-XxFo_bnZ2dnUVZ_hGdnZ2d__13233.7669296705$1175620535$gmane$org@mozilla.org>
You need to initialize JavaXPCOM:
	Mozilla.getInstance().initialize(grePath);

and you need to initialize Mozilla:
	Mozilla.getIntance().initEmbedding(grePath, grePath, locationProvider);

You need to provide the 'locationProvider' class.  Have a look at the 
embedding documentation on http://developer.mozilla.org.


javier



[email protected] wrote:
> Hi,
> I tried to execute the following example given in the javaxpcom page
> 
>      Mozilla moz = Mozilla.getInstance();
>      nsIServiceManager serviceManager = moz.getServiceManager();
>      nsIAppStartup appStartup =
> (nsIAppStartup)serviceManager.getServiceByContractID("@mozilla.org/
> toolkit/app-startup;1", nsIAppStartup.NS_IAPPSTARTUP_IID);
>      nsIWindowCreator windowCreator =
> (nsIWindowCreator)appStartup.queryInterface(nsIWindowCreator.NS_IWINDOWCREATOR_IID);
> 
>      nsIWindowWatcher windowWatcher =
> (nsIWindowWatcher)serviceManager.getServiceByContractID("@mozilla.org/
> embedcomp/window-watcher;1", nsIWindowWatcher.NS_IWINDOWWATCHER_IID);
>      windowWatcher.setWindowCreator(windowCreator);
> 
>      nsIDOMWindow win = windowWatcher.openWindow(null, "chrome://your-
> app/content/window.xul", "mywindow", "chrome,resizable,centerscreen",
> null);
>      windowWatcher.setActiveWindow(win);
>       appStartup.run();
> 
> but it showing error
> Exception in thread "main" org.mozilla.xpcom.XPCOMException: Attempt
> to use unitialized XPCOM object  (0x80004003)
>         at org.mozilla.xpcom.Mozilla.getServiceManager(Mozilla.java:
> 715)
> 
> i am using Redhat enterprise linux v4....
>
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.