Hi Jürgen, > i forgot to mention that it probably works only with an official build > of OO (and a default installation). Debian use as far as i know an own > start up script which probably causes the problem.
I found out how to get it to work on Debian and other OS. >>> jar content: >>> com/sun/star/lib/loader/Loader$CustomURLClassLoader.class >>> com/sun/star/lib/loader/Loader.class >>> com/sun/star/lib/loader/InstallationFinder$StreamGobbler.class >>> com/sun/star/lib/loader/InstallationFinder.class >>> com/sun/star/lib/loader/WinRegKey.class >>> com/sun/star/lib/loader/WinRegKeyException.class >>> win/unowinreg.dll >>> de/twc/oocom/OOCom.class >>> MANIFEST.MF: >>> Main-Class: com.sun.star.lib.loader.Loader >>> >>> Name: com/sun/star/lib/loader/Loader.class >>> Application-Class: de.twc.oocom.OOCom Here was a line missing: Application-Name: de/twc/oocom/OOCom.class Then I started my application with following command: [EMAIL PROTECTED]> /usr/lib/sun-j2se5.0-jdk/bin/java -jar /nfs/public/Tobias/Test/jars/oocom_test.jar 9000 "/home/tobias/test.odt" I added the hints in the answer section of the snippet. Thanks for this hint. It is really useful for me! Greetings, Tobias
<?xml version="1.0"?> <!-- $RCSfile: $ last change: $Revision: $ $Author: $ $Date: $ (c)2003 by the copyright holders listed with the author-tags. If no explicit copyright holder is mentioned with a certain author, the author him-/herself is the copyright holder. All rights reserved. Public Documentation License Notice: The contents of this Documentation are subject to the Public Documentation License Version 1.0 (the "License"); you may only use this Documentation if you comply with the terms of this License. A copy of the License is available at http://www.openoffice.org/licenses/PDL.html The Original Documentation can be found in the CVS archives of openoffice.org at the place specified by RCSfile: in this header. The Initial Writer(s) of the Original Documentation are listed with the author-tags below. The Contributor(s) are listed with the author-tags below without the marker for being an initial author. All Rights Reserved. --> <snippet language="Java" application="Office"> <keywords> <keyword>bootstrap</keyword> <keyword>start</keyword> </keywords> <authors> <author id="tobiaskrais" initial="false" email="[EMAIL PROTECTED]" copyright="Copy it and use it.">Tobias Krais</author> </authors> <question heading="Bootstrap OpenOffice">How to bootstrap OpenOffice without having one already started? </question> <answer> <p>This method bootstraps OpenOffice.</p> <p>If you don't want to add all the UNO jars to your classpath do following:</p> <p>1. Add these files to your jar (you find them in a SDK subfolder):</p> <p>com/sun/star/lib/loader/Loader$CustomURLClassLoader.class</p> <p>com/sun/star/lib/loader/Loader.class</p> <p>com/sun/star/lib/loader/InstallationFinder$StreamGobbler.class</p> <p>com/sun/star/lib/loader/InstallationFinder.class</p> <p>com/sun/star/lib/loader/WinRegKey.class</p> <p>com/sun/star/lib/loader/WinRegKeyException.class</p> <p>win/unowinreg.dll</p> <p></p> <p>2. Create a MANIFEST.MF file for your jar and use it when creating</p> <p>the jar. The MANIFEST.MF must look like:</p> <p>Main-Class: com.sun.star.lib.loader.Loader</p> <p></p> <p>Name: com/sun/star/lib/loader/Loader.class</p> <p>Application-Class: my.package.MyClass</p> <p>Application-Name: my/package/MyClass.class</p> <p></p> <p>3. Start your application using e.g. this command:</p> <p>java -jar myjar.jar</p> <listing>// You have to import following classes: // import com.sun.star.comp.helper.Bootstrap; // import com.sun.star.comp.helper.BootstrapException; // import com.sun.star.lang.XMultiComponentFactory; // import com.sun.star.uno.XComponentContext; // You will need these Objects often, better define them global... Object desktop = null; XComponentContext xRemoteContext = null; XMultiComponentFactory xRemoteServiceManager = null; /** * This method bootstraps a OpenOffice and returns it's Desktop. * * @return */ public void bootstrapOpenOffice() { try { // Connect or start a OpenOffice instance xRemoteContext = Bootstrap.bootstrap(); System.out.println("Connected to a running OpenOffice ..."); } catch (BootstrapException e) { System.out.println("Unable to start OpenOffice. Starter says:"); System.out.println(e.getLocalizedMessage()); } // get OO desktop xRemoteServiceManager = xRemoteContext.getServiceManager(); try { desktop = xRemoteServiceManager.createInstanceWithContext( "com.sun.star.frame.Desktop", xRemoteContext ); } catch (Exception e) { System.out.println("OpenOffice started, but can't get Desktop:"); System.out.println(e.getLocalizedMessage()); } } </listing> </answer> <versions> <version number="2.0.x" status="tested"/> <version number="1.1.x" status="tested"/> </versions> <operating-systems> <operating-system name="All"/> </operating-systems> <changelog> <change author-id="tobiaskrais" date="2006-03-27">Added the hints for usage without classpath.</change> <change author-id="" date="2006-03-20">Initial version</change> </changelog> </snippet>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]