Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi Rony, Rony G. Flatscher wrote: Hi there, just wanted to report that the genuine OOo 2.1 can be invoked via Java from the command line, whereas the Ubuntu version cannot. Did remove the genuine OOo 2.1 and re-installed the Ubuntu OOo 2.0.4 version (the latest they have). The Ubuntu version places the binaries into /usr/lib/openoffice/program and the Java support to /usr/share/java/openoffice. Setting CLASSPATH and LD_LIBRARY_PATH+PATH to their respective settings does throw a com.sun.star.comp.helper.BootstrapException (bootstrap cannot find office executable). Could it be that they have no test case for running OOo from the commandline using Java ? Could that really be the case?? Or is there something that I might still oversee, which is important for the Ubuntu version but not for the genuine OOo distribution? Regards, the problem is quite simple. The Ubuntu guys install OpenOffice or part of it in a way which is not supported in all cases. For example the Java UNO bootstrap mechanism depends on a specific layout (directory structure, Stephan has pointed out earlier). And yes i agree that they probably don't test it at all. For some distributions (we had this problem before with Debian as well) it is enough when OO.org started and the UI appears correctly. You should submit an issue to Ubuntu and communicate the problem there. Juergen ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi, these were the required jar files suggested by netbeans: (i noticed you didnt mention jut.jar in the comments of your code) juh.jar jurt.jar jut.jar officebean.jar ridl.jar unoil.jar Thank you for this list, will look into it! --- Ad your environment: it seems that you have the OOo SDK (and NetBeans) at your disposal. The successful run from a packaged jar-file is interesting: if possible, could you supply the jar as well your environment settings in the command line window in which you are able to run the app successfully? See, I would like to learn what is needed for an out-of-the-box Ubuntu OOo installation to be employed to run Java apps from the command line. (Here SDK/NetBeans/Eclipse setups can come into ones way as it is then not always clear which environment is in effect under which circumstances.) TIA, ---rony P.S.: Will be a week off (practically without e-mail or WWW access), so I may be able to come back only in a week or so. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi, these were the required jar files suggested by netbeans: (i noticed you didnt mention jut.jar in the comments of your code) juh.jar jurt.jar jut.jar officebean.jar ridl.jar unoil.jar One last remark: it is likely that your pacakge works because of officebean.jar. But I would not want to be dependent on this jar-file as it mandates the usage of OOo. The solution should be genuine such that only the Java-UNO-interface is necessary (mostly acquiring the OOo components, but since URE has been existing, the solution should be standard), as is the case with the genuine OOo installation from the OOo web site. Or with other words: you should be able to execute the compiled Java class from the commandline by issuing java helloworld. If you can make this work with the Ubuntu OOo installation, then I would be very thankful, if you could share the environment setting of that command line window. Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
I tried executing the attached jar file on another ubuntu edgy box WITHOUT netbeans or the OO sdk...with just OO2.04 (the standard Ubuntu openoffice installation) installed, it works perfectly, if i do either : java -jar helloworld.jar or if do a launch with JVM from the Gnome file manager... the environment settings are that of an out of the box ubuntu edgy install Ad your environment: it seems that you have the OOo SDK (and NetBeans) at your disposal. The successful run from a packaged jar-file is interesting: if possible, could you supply the jar as well your environment settings in the command line window in which you are able to run the app successfully? As you can see my development box has a different setup, and the test box has the standard ubuntu setup it works fine in both See, I would like to learn what is needed for an out-of-the-box Ubuntu OOo installation to be employed to run Java apps from the command line. (Here SDK/NetBeans/Eclipse setups can come into ones way as it is then not always clear which environment is in effect under which circumstances.) helloworld.jar Description: application/jar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
In fact... officebean.jar is not required for the helloworld appit was suggested by the netbeans wizard, but it will work without it On 2/5/07, Rony G. Flatscher [EMAIL PROTECTED] wrote: One last remark: it is likely that your pacakge works because of officebean.jar. But I would not want to be dependent on this jar-file as it mandates the usage of OOo. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi, In fact... officebean.jar is not required for the helloworld appit was suggested by the netbeans wizard, but it will work without it That is very interesting! Could you please either send me the jar-file (or its included manifest file) and the settings of CLASSPATH, PATH and LD_LIBRARY_PATH (from the test machine)? TIA, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi Jürgen, the problem is quite simple. The Ubuntu guys install OpenOffice or part of it in a way which is not supported in all cases. For example the Java UNO bootstrap mechanism depends on a specific layout (directory structure, Stephan has pointed out earlier). And yes i agree that they probably don't test it at all. For some distributions (we had this problem before with Debian as well) it is enough when OO.org started and the UI appears correctly. You should submit an issue to Ubuntu and communicate the problem there. O.K., will have a week's time (off-line) to look into this further to be sure that it is really them. It seems however that ashok_ somehow is able to run the test program from a jar (but am not sure why and how yet). Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Rony G. Flatscher wrote: Hi, In fact... officebean.jar is not required for the helloworld appit was suggested by the netbeans wizard, but it will work without it That is very interesting! Could you please either send me the jar-file (or its included manifest file) and the settings of CLASSPATH, PATH and LD_LIBRARY_PATH (from the test machine)? please stop the puzzling of arbitrary bits and bytes without the background knowledge. The next one use it a little bit different and it won't work again. Always take a clean OO.org installation from the web side or an correct installed/deployed OO.org version from a distribution. If you want to run a simply client application using the simple bootstrap mechanism you have to package the bootstrap helper class files and the winreg.dll (for real platform independence) with your application jar file and have to adapt the manifest file accordingly. The NetBeans integration client wizard do exactly that. It simply package a correct jar file for a simple client application, nothing more. Ok, the wizard generates the bootstrap call in the main function, but that's it. The bootstrap mechanism creates an own classloader with the necessary settings and instantiate the original main class with this new classloader. The default office is searched on the system and depending on the directory structure the necessary jar, executables ... are found and started. The office gets started and the client communicate over a named pipe connection with the office. By using this mechanism you don't need a classpath or LD_LIBRARY_PATH. simply start your application with java -jar HelloWorld.jar. Searching the default office is sometimes a little bit tricky. On windows we use the winreg.dll to read from the registry directly and on the Unix systems we searched in /usr/bin/ for the correct link (can't remember the exact search algorithm) The bootstrap mechanism won't work when you copy the UNO jars form an office installation to somewhere else or when you deploy them with your application. Copy the jars make only sense when you want to connect to an office on a different machine and in this case you bootstrap a little bit different. I agree that it is not 100% optimal and in an ideal world we would have the URE available in the system and the office would register all services there. We will see what we can provide in the future. Juergen TIA, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
i have sent you the project with the build scripts offlist... but you dont need things like ld_library_path for the jar deploymet to work... there is an installationfinder loader packaged within the jar which locates the openoffice installation and other arbitary paths automatically which i why i was suggesting that you use the netbeans plugin to build your project... it generates the neccessary ant scripts ... On 2/5/07, Rony G. Flatscher [EMAIL PROTECTED] wrote: Could you please either send me the jar-file (or its included manifest file) and the settings of CLASSPATH, PATH and LD_LIBRARY_PATH (from the test machine)? TIA, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Rony G. Flatscher wrote: See, I would like to learn what is needed for an out-of-the-box Ubuntu OOo installation to be employed to run Java apps from the command line. (Here SDK/NetBeans/Eclipse setups can come into ones way as it is then not always clear which environment is in effect under which circumstances.) Not using ubuntu, but I am interested in the environment variables too so I tried this on Mac OS, using no IDE and outside SDK. These look like the minimal necessary steps. I did it using ant but there is nothing special in the build.xml file, so this should give enough clues for using a makefile or simple command line. (a) make some directory, it could be anywhere but I used ~/test (b) copy into ~/test the ant mybuild.xml file from SDK/examples/DevelopersGuide/FirstSteps/build_FirstUnoContact.xml (c) put your java class file into ~/test. I used the mentioned CreateTextDocument.java but the contained class has to be made public (d)in the mybuild.xml file replace all FirstUnoContact by CreateTextDocument (e) copy the SDK/classes folder into ~/test Some of the files in here are needed for the bootstrap loader (f) the following environment variables may vary, these are only needed for the mybuild.xml file OO_SDK_HOME=~/test where we put everything OFFICE_HOME= the path above program/soffice (g) the following environment seems to be sufficient in any case, maybe not all necessary... UNO_PATH=$OFFICE_HOME/program OFFICE_PROGRAM_PATH=$OFFICE_HOME/program DYLD_LIBRARY_PATH=$OFFICE_HOME/program:.: Then at the command line ant -f mybuild.xml And it runs, no IDE, no SDK. jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Next .... (Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi there, thanks to everyone, I was not aware of special needs to find OOo. Ashok was kind enough to send me his jar file, and its content is: Archive: helloworld.jar testing: META-INF/OK testing: META-INF/MANIFEST.MF OK testing: org/ OK testing: org/openoffice/ OK testing: org/openoffice/helloworld/ OK testing: org/openoffice/helloworld/helloworld.class OK testing: com/ OK testing: com/sun/ OK testing: com/sun/star/OK testing: com/sun/star/lib/OK testing: com/sun/star/lib/loader/ OK testing: com/sun/star/lib/loader/InstallationFinder$StreamGobbler.class OK testing: com/sun/star/lib/loader/InstallationFinder.class OK testing: com/sun/star/lib/loader/Loader$CustomURLClassLoader.class OK testing: com/sun/star/lib/loader/Loader.class OK testing: com/sun/star/lib/loader/WinRegKey.class OK testing: com/sun/star/lib/loader/WinRegKeyException.class OK testing: win/ OK testing: win/unowinreg.dllOK No errors detected in compressed data of helloworld.jar. This matches Jürgen's explanations. However, *where* would one find the com.sun.star.lib.loader. package? (Just did a grep over OOHome/program/classes, but none of those deployed jar would contain a class by that name.) Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Next .... (Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Rony G. Flatscher wrote: However, *where* would one find the com.sun.star.lib.loader. package? Look in the SDK/classes directory... Get the SDK at api.openoffice.org jim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] SDK-only Java libs? (Re: [dev] Next .... (Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi Jim, However, *where* would one find the com.sun.star.lib.loader. package? Look in the SDK/classes directory... Get the SDK at api.openoffice.org Oh, I see. Was not aware of that at all. But this would mean that one cannot reliably deploy Java applications from the command line without that supporting library? If so, why not supply it with the general installation of OOo (putting that library into OOoXYZ/classes directory? It seems to me that that would be the appropriate place, which everyone then could rely to find it. Or with other words, distribute that jar as you distribute the juh.jar etc. --- And being there, why not fold juh.jar, etc. into *one* jar only? Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] SDK-only Java libs? (Re: [dev] Next .... (Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi there, just a stupid question: why doesn't the Bootstrap helper class use the com.sun.star.lib.loader. knowing the important role of that library to find the OO executable ? Regards, ---rony However, *where* would one find the com.sun.star.lib.loader. package? Look in the SDK/classes directory... Get the SDK at api.openoffice.org Oh, I see. Was not aware of that at all. But this would mean that one cannot reliably deploy Java applications from the command line without that supporting library? If so, why not supply it with the general installation of OOo (putting that library into OOoXYZ/classes directory? It seems to me that that would be the appropriate place, which everyone then could rely to find it. Or with other words, distribute that jar as you distribute the juh.jar etc. --- And being there, why not fold juh.jar, etc. into *one* jar only? Regards, ---rony
Re: [dev] SDK-only Java libs? (Re: [dev] Next .... (Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Rony G. Flatscher wrote: Hi there, just a stupid question: why doesn't the Bootstrap helper class use the com.sun.star.lib.loader. knowing the important role of that library to find the OO executable ? See http://www.openoffice.org/issues/show_bug.cgi?id=66050 for a planned improvement in that area. -Stephan Regards, ---rony [...] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi there, just wanted to report that the genuine OOo 2.1 can be invoked via Java from the command line, whereas the Ubuntu version cannot. Did remove the genuine OOo 2.1 and re-installed the Ubuntu OOo 2.0.4 version (the latest they have). The Ubuntu version places the binaries into /usr/lib/openoffice/program and the Java support to /usr/share/java/openoffice. Setting CLASSPATH and LD_LIBRARY_PATH+PATH to their respective settings does throw a com.sun.star.comp.helper.BootstrapException (bootstrap cannot find office executable). Could it be that they have no test case for running OOo from the commandline using Java ? Could that really be the case?? Or is there something that I might still oversee, which is important for the Ubuntu version but not for the genuine OOo distribution? Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
I am running oOo 2.1 on ubuntu... I am running the standard jdk 1.5.08 installation... everything works fine for me. I noticed that i had to explicitly enable Java in oOo after the installation, by going to tools-options-java and expicitly selecting a JVM there maybe that is the step you are missing? On 2/4/07, Rony G. Flatscher [EMAIL PROTECTED] wrote: Hi there, just wanted to report that the genuine OOo 2.1 can be invoked via Java from the command line, whereas the Ubuntu version cannot. Did remove the genuine OOo 2.1 and re-installed the Ubuntu OOo 2.0.4 version (the latest they have). The Ubuntu version places the binaries into /usr/lib/openoffice/program and the Java support to /usr/share/java/openoffice. Setting CLASSPATH and LD_LIBRARY_PATH+PATH to their respective settings does throw a com.sun.star.comp.helper.BootstrapException (bootstrap cannot find office executable). Could it be that they have no test case for running OOo from the commandline using Java ? Could that really be the case?? Or is there something that I might still oversee, which is important for the Ubuntu version but not for the genuine OOo distribution? Regards, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
I noticed you were setting a whole lot of classpaths i would suggest you get hold of netbeans 6 milestone 5 IDE, and install the openoffice development plugin on top of that. It takes a lot of pain out of the openoffice development process.by detecting and setting up environment variables and so on - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hi, ashok _ wrote: I am running oOo 2.1 on ubuntu... I am running the standard jdk 1.5.08 installation... everything works fine for me. I noticed that i had to explicitly enable Java in oOo after the installation, by going to tools-options-java and expicitly selecting a JVM there maybe that is the step you are missing? This seems to be necessary only, if Java is invoked from OpenOffice itself (either via the scripting framework, or because of using a Java UNO component, etc.). If one is using Java from the outside of OOo then that version of Java is used to drive OOo. One could set up different vesions of Java and use them to interface with OOo (as a matter of fact I have Java 1.1, 1.2, 1.3, 1.4, 1.5 and 1.6 on my machine, using 1.4 through 1.6 when running against OOo). --- So the question would be for me whether you are able to compile and run the enclosed Java program from the *command* line (not NetBeans, Eclipse etc.) under Ubuntu's OOo? If so, I would be *very* interested in your environment settings! TIA, ---rony CreateTextDocument.java Description: java/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [dev] Little update (Re: [dev] Seeking help on Ubuntu 6.10 OOo v. 2.0.4 for starting OOo via Java
Hello Rony: I used your code to successfully build and execute an openoffice UNO client application. (See the attached code). i executed the jar file from the command line using: java -jar helloworld.jar and it launched openoffice writer and wrote the hellow world text into the editor windwo I am running ubuntu edgy, openoffice 2.1 , openoffice 2.1 SDK (in /opt/openoffice.org2.1_sdk), jdk 1.5.08 I built the code using Netbeans (using the openoffice wizard, by choosing OpenOffice UNO/Client Application as the project option). On 2/5/07, Rony G. Flatscher [EMAIL PROTECTED] wrote: Hi, ashok _ wrote: I am running oOo 2.1 on ubuntu... I am running the standard jdk 1.5.08 installation... everything works fine for me. I noticed that i had to explicitly enable Java in oOo after the installation, by going to tools-options-java and expicitly selecting a JVM there maybe that is the step you are missing? This seems to be necessary only, if Java is invoked from OpenOffice itself (either via the scripting framework, or because of using a Java UNO component, etc.). If one is using Java from the outside of OOo then that version of Java is used to drive OOo. One could set up different vesions of Java and use them to interface with OOo (as a matter of fact I have Java 1.1, 1.2, 1.3, 1.4, 1.5 and 1.6 on my machine, using 1.4 through 1.6 when running against OOo). --- So the question would be for me whether you are able to compile and run the enclosed Java program from the *command* line (not NetBeans, Eclipse etc.) under Ubuntu's OOo? If so, I would be *very* interested in your environment settings! TIA, ---rony - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] /* * helloworld.java * * Created on 05.01.2007 - 09:59:46 * */ package org.openoffice.helloworld; import com.sun.star.uno.XComponentContext; import com.sun.star.comp.helper.Bootstrap; /** * * @author administrator */ public class helloworld { /** Creates a new instance of helloworld */ public helloworld() { } /** * @param args the command line arguments */ public static void main(String[] args) { try { // get the remote office component context XComponentContext xContext = Bootstrap.bootstrap(); com.sun.star.frame.XDesktop xDesktop = null; com.sun.star.lang.XMultiComponentFactory xMCF = null; // (2) get the service manager xMCF = xContext.getServiceManager(); if( xMCF != null ) { System.out.println(Connected to a running office ...); // (3) start up an instance of office Object oDesktop = xMCF.createInstanceWithContext( com.sun.star.frame.Desktop, xContext); // (4a) get the XDesktop interface object xDesktop = (com.sun.star.frame.XDesktop) com.sun.star.uno.UnoRuntime.queryInterface( com.sun.star.frame.XDesktop.class, oDesktop); // (4b) get the desktop's component loader interface object com.sun.star.frame.XComponentLoader xComponentLoader = (com.sun.star.frame.XComponentLoader) com.sun.star.uno.UnoRuntime.queryInterface( com.sun.star.frame.XComponentLoader.class, xDesktop); // create an empty text (swriter) document com.sun.star.beans.PropertyValue xEmptyArgs[] = // empty property array new com.sun.star.beans.PropertyValue[0]; // (5) create an empty word processor (swriter) component (document) com.sun.star.lang.XComponent xComponent = xComponentLoader.loadComponentFromURL( private:factory/swriter,_blank, 0, xEmptyArgs); // (6) get Text interface object and set a text com.sun.star.text.XTextDocument xTextDocument = (com.sun.star.text.XTextDocument) com.sun.star.uno.UnoRuntime.queryInterface( com.sun.star.text.XTextDocument.class, xComponent); com.sun.star.text.XText xText = xTextDocument.getText(); // ((com.sun.star.text.XTextRange) xText).setString(Java was here!\r---rgf); xText.setString(Java was here!\r---rgf); } } catch (java.lang.Exception e){ e.printStackTrace(); } System.exit( 0 ); } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]