Hi there, the following example program runs on many installations/platforms.
However, it *should* run flawlessly on *any* OOo installation: -------------------- cut here ("CreateTextDocument.java")) -------------------- import com.sun.star.beans.PropertyValue; import com.sun.star.comp.helper.Bootstrap; import com.sun.star.frame.XComponentLoader; import com.sun.star.frame.XDesktop; import com.sun.star.lang.XComponent; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.text.XText; import com.sun.star.text.XTextDocument; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; class CreateTextDocument { public static void main (String args[]) { try { XComponentContext xContext=Bootstrap.bootstrap(); // bootstrap UNO XMultiComponentFactory xMCF=xContext.getServiceManager(); if (xMCF != null) { Object oDesktop=xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", xContext); XDesktop xDesktop=(XDesktop) UnoRuntime.queryInterface(XDesktop.class, oDesktop); XComponentLoader xComponentLoader=(XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xDesktop); String url="private:factory/swriter"; // define a text document PropertyValue noProps[]=new PropertyValue[0]; // no properties XComponent xWriterComponent=xComponentLoader.loadComponentFromURL( url, "_blank", 0, noProps); // Fortsetzung nächste Seite ... // ... Fortsetzung von vorheriger Seite XTextDocument xTextDocument=(XTextDocument) UnoRuntime.queryInterface(XTextDocument.class, xWriterComponent); XText xText=xTextDocument.getText(); xText.setString("Hallo Chemnitz, hier spricht Java!"); } } catch( Exception e) { e.printStackTrace(System.err); System.exit(1); } System.exit(0); } } -------------------- cut here -------------------- Setup the environment such that CLASSPATH points to the following OOo jars (wherever they are installed on the target system): jurt.jar, unoil.jar, ridl.jar, and juh.jar (sandbox.jar is not needed anymore, starting with OOo v2.0). Then compile the program with the Java compiler (javac CreateTextDocument.java) and run the compiled class with "java CreateTextDocument". Regards, ---rony --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]