[Java solution] "no office executable found!"

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Java solution] "no office executable found!"

Postby hol.sten » Sun Feb 10, 2008 4:10 pm

Introduction
This is a short How-To for quickly solving the regularly occurring error "no office executable found!". You can read a huge number of threads in various OpenOffice.org forums dealing with this problem. This error is caused by using the Bootstrap Connection Mechanism (introduced with OOo 2.x) in conjunction with moving or copying "juh.jar" (OOo's "Java UNO Helper" JAR file containing the class file "Bootstrap.class") from the subfolder "program\classes" of the OOo installation folder (which is for example on Windows "c:\program files\OpenOffice.org 2.3") to another folder (mostly a subfolder, which is directly accessible from a web container or web server like for example Tomcat).

How-to
So, if you're encountering "no office executable found!" follow these steps:
  1. Download the file "bootstrapconnector.jar" attached to this post and save it.
  2. Put the JAR file "bootstrapconnector.jar" for example in the same folder, where you put "juh.jar", and add it to your CLASSPATH or add it in your IDE to the libraries for source code compiling (for example open in NetBeans the project properties and select there "Libraries" > tab "Compile" > press "Add JAR/Folder" > locate the "bootstrapconnector.jar" and press "Open").
  3. Determine the folder of your OpenOffice.org executable "soffice.exe" (on Windows systems) or "soffice" (on *nix systems). On Windows it might be something like "c:\program files\OpenOffice.org 2.3\program\", and on *nix for example something like "/opt/openoffice.org2.3/program" or "/usr/lib/openoffice.org/program".
  4. Edit your Java source code file, that tries to get the connection by calling "Bootstrap.bootstrap()". This is mostly done with a Java source code line looking like this:
    Code: Select all   Expand viewCollapse view
    XComponentContext xContext = Bootstrap.bootstrap();
    Perform the following steps in this Java source file:
    1. Add the following line to your import statements:
      Code: Select all   Expand viewCollapse view
      import ooo.connector.BootstrapSocketConnector;
    2. Add a line above "Bootstrap.bootstrap()" to assign the name of the folder of your OpenOffice.org executable to a String variable:
      Code: Select all   Expand viewCollapse view
      String oooExeFolder = "C:/Program Files/OpenOffice.org 2.3/program/";
    3. Change the call of "Bootstrap.bootstrap()" to "BootstrapSocketConnector.bootstrap(oooExeFolder)":
      Code: Select all   Expand viewCollapse view
      XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);
    4. Save and compile the edited file and see if "no office executable found!" has really vanished.
  5. If you want to learn more about what you can do with "bootstrapconnector.jar", stay tuned. (To be continued...)

Credits
Most of the source code in the attached JAR file has been taken from the Java class "Bootstrap.java" (Revision: 1.15) from the UDK projekt (Uno Software Development Kit) from OpenOffice.org (http://udk.openoffice.org/). The source code is available for example through a browser based online version control access at http://udk.openoffice.org/source/browse/udk/. The Java class "Bootstrap.java" is there available at http://udk.openoffice.org/source/browse ... iew=markup

The idea to develop the BootstrapConnector, BootstrapSocketConnector and BootstrapPipeConnector comes from the blog "Getting started with the OpenOffice.org API part III : starting OpenOffice.org with jars not in the OOo install dir by Wouter van Reeven" (http://technology.amis.nl/blog/?p=1284) and from various posts in the "(Unofficial) OpenOffice.org Forum" at http://www.oooforum.org/ and this forum complaining about "no office executable found!".

Jar file (attached as ZIP file)
Attachments
bootstrapconnector.jar
The JAR file "bootstrapconnector.jar" contains several class and source files and a Java example using the BootstrapSocketConnector class.
(15.95 KiB) Downloaded 10003 times
Last edited by hol.sten on Thu Apr 10, 2008 9:50 pm, edited 2 times in total.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Change log

Postby hol.sten » Sun Feb 10, 2008 4:28 pm

10. Apr 2008: bootstrapconnector.zip to bootstrapconnector.jar renamed
10. Feb 2008: Creation of Java solution
Last edited by hol.sten on Thu Apr 10, 2008 9:51 pm, edited 1 time in total.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby ggraham412 » Thu Feb 28, 2008 1:45 am

Thank you so much for this, it worked as specified.

(But for me, I used backwards slash windows path convention in step 4b.)
ggraham412
 
Posts: 5
Joined: Mon Feb 25, 2008 10:12 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Thu Feb 28, 2008 9:29 pm

ggraham412 wrote:I used backwards slash windows path convention in step 4b.

But it does work with slashs, too? I wrote and tested everything in this thread on Windows XP and never had a problem with slashs.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby mbacyrille2002 » Mon Mar 03, 2008 11:21 am

Good morning,

The sample is not work when I test it.

The execution is shut down in this instruction :
XComponentContext remoteContext = BootstrapSocketConnector.bootstrap(OOO_EXEC_FOLDER);

Please canyou help me?
mbacyrille2002
 
Posts: 1
Joined: Mon Feb 25, 2008 5:27 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Mon Mar 03, 2008 9:07 pm

mbacyrille2002 wrote:The sample is not work when I test it.

The execution is shut down in this instruction :
XComponentContext remoteContext = BootstrapSocketConnector.bootstrap(OOO_EXEC_FOLDER);

Please canyou help me?

Please read the Survival Guide for the forum. Start with telling me which OOo version, which operating system, which IDE and which java version you are using. Tell me what you tried. Which steps you made and which exception you get. Otherwise I cannot help you.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby ggraham412 » Thu Mar 20, 2008 6:33 pm

Yes, now that you mention it, I just checked and it works for me with forward slashes too. Sorry for the miscommunication: I've been burned on this before and thought it was useful to mention. (Still working for me, by the way... )
ggraham412
 
Posts: 5
Joined: Mon Feb 25, 2008 10:12 pm

Re: [Java solution] "no office executable found!"

Postby charlesvc » Wed Apr 09, 2008 9:08 am

Hol.sten,

I tested with your jar file, but failed. And i have one query now to you:- that how can we update port as 8100, there is no server right, i am executing in tomcat and taking instance from my system, so how can i use socket connection instead of pipe connection.

Kindly requested to revert back with a solution
charlesvc
 
Posts: 10
Joined: Thu Mar 13, 2008 4:48 pm

Re: [Java solution] "no office executable found!"

Postby charlesvc » Wed Apr 09, 2008 9:43 am

Hi Hol.sten,

Kindly request to see my posts and messages and give some priority
charlesvc
 
Posts: 10
Joined: Thu Mar 13, 2008 4:48 pm

Re: [Java solution] "no office executable found!"

Postby charlesvc » Wed Apr 09, 2008 2:01 pm

Hi hol.sten,

When i am trying to get the soffice start from web application to convert word to pdf, actually when i look into taskmanager, both soffice.bin and soffice.exe are running, but no window is opening and not converting to pdf.

Kindly requested to revert back with a positive reply as if this error resolved, our project going to complete. So I humbly request you to provide me with a solution.

Thanking you
Charles v c
charlesvc
 
Posts: 10
Joined: Thu Mar 13, 2008 4:48 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Thu Apr 10, 2008 9:43 pm

charlesvc wrote:how can i use socket connection instead of pipe connection.

The JAR file I provide above contains, beside some other files, the BootstrapSocketConnector. All you have to do is to change your code as I wrote down above (change Bootstrap.bootstrap() to BootstrapSocketConnector.bootstrap(...)). That's all. If you still encounter problems check the name of your folder of the OOo installation containing the soffice executable.

And if you prefer a pipe connection, use the BootstrapPipeConnector instead.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby charlesvc » Fri Apr 11, 2008 7:19 am

I changed as you told, but not working from all versions of apache tomcat, but successfully worked from jakarta-tomcat. So, May i know what is the exact problem. somebody told me to update classpath at runtime i did so using system.setproperty(), but failed again. Ceasing here wishing to hear from you.

Thanking you
Charles v c
charlesvc
 
Posts: 10
Joined: Thu Mar 13, 2008 4:48 pm

Re: [Java solution] "no office executable found!"

Postby JMysak » Tue May 06, 2008 4:13 pm

I get the following error when trying to use the bootstrap jar you provided...

java.lang.UnsupportedClassVersionError: Bad version number in .class file

I am using Java 1.5.0_13 on MacOS 10.5. Any chance you compiled your code with Java 1.4.2 or something other than 5.0?
JMysak
 
Posts: 6
Joined: Tue May 06, 2008 4:09 pm

Re: [Java solution] "no office executable found!"

Postby JMysak » Tue May 06, 2008 4:23 pm

Just checked your MANIFEST (and answered my own question). Looks like you compiled with 1.5.0_14.

In any case, I just noticed you included the src in the jar (thanks!). I'll recompile and see if that resolves my issue.
JMysak
 
Posts: 6
Joined: Tue May 06, 2008 4:09 pm

Re: [Java solution] "no office executable found!"

Postby JMysak » Tue May 06, 2008 4:35 pm

Works for me after recompiling. Thanks!

Code: Select all   Expand viewCollapse view
Connected to a running office ...
remote ServiceManager is available
JMysak
 
Posts: 6
Joined: Tue May 06, 2008 4:09 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Tue May 06, 2008 9:20 pm

JMysak wrote:Works for me after recompiling. Thanks!

Code: Select all   Expand viewCollapse view
Connected to a running office ...
remote ServiceManager is available

Thanks for the affirmation! Good to know the old trick from an old movie worked for you: "Use the source, Luke" ;-)
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby ggraham412 » Mon Jun 02, 2008 3:59 pm

Hi,

I've written a short example program using the bootstrapconnector.jar that uses Open Office to convert input office documents to PDF, and optionally uses Ghostscript to merge the output. The code is available with a short article here: http://www.codeproject.com/KB/java/PDFCM.aspx. If you like it, please give it a plug. (If not, please take the time to explain why. ;)

Thanks again for the bootstrapconnector.jar- It saved this newbie many hours!

-Greg
ggraham412
 
Posts: 5
Joined: Mon Feb 25, 2008 10:12 pm

Re: [Java solution] "no office executable found!"

Postby thehl » Thu Jun 26, 2008 4:46 pm

I'm having some kind of version error on the jar file. Can I get the source code for this, please?

Thanks.
OOo 2.4.X on Ms Windows XP + Redhat Linux, Ubuntu
thehl
 
Posts: 1
Joined: Thu Jun 26, 2008 4:43 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Thu Jun 26, 2008 7:39 pm

thehl wrote:I'm having some kind of version error on the jar file. Can I get the source code for this, please?

Download bootstrapconnector.jar from the first post of this thread. To ease version errors and other problems I put the class files and the source code into that jar file.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby Hardie82 » Fri Oct 24, 2008 3:16 pm

Hi. I want to develop a web-application which creates doc-/pdf-reports from analysed excelfiles. Therefore I've decided to use the oo-api and got it running as a stand-alone application. Now I wanted to transfer it to a web-application and got the described problem with this exception. After reading this thread I included the jar-file. But using the bootstrap-method there is a difference between the code in this thread an the method from BootstrapConnector-class. In the method there are three parameters required. Were there some changes to the class and what's about the other two parameters? By the way I am using Tomcat 6, Eclipse 3.4 and OO 2.4.

Regards
Hardie
OOo 2.3.X on Ms Windows XP
Hardie82
 
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Postby Hardie82 » Fri Oct 24, 2008 3:20 pm

If I tried to use the following code I got a StackOverflowError:

String ooExeFolder = "C:\\Programme\\OpenOffice.org 2.4\\program\\";
this.xContext = BootstrapConnector.bootstrap(ooExeFolder, "", "");
XMultiComponentFactory xMCF = this.xContext.getServiceManager();
this.xCLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, xMCF.createInstanceWithContext("com.sun.star.frame.Desktop", this.xContext));
OOo 2.3.X on Ms Windows XP
Hardie82
 
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Fri Oct 24, 2008 4:06 pm

Hardie82 wrote:After reading this thread I included the jar-file. But using the bootstrap-method there is a difference between the code in this thread an the method from BootstrapConnector-class.

That depends on you! You can use the JAR as I wrote in the first example in this thread:
Code: Select all   Expand viewCollapse view
XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);

Or you can use the bootstrap-method with three parameters. If you want to know what the other two parameters are for, take a look into the JAR file: It contains the whole source code with some comments.

Hardie82 wrote:In the method there are three parameters required.

My advice: Use the method from the example with just one parameter!

Hardie82 wrote:Were there some changes to the class

No.

Hardie82 wrote:and what's about the other two parameters?

As said above: Take a look into the JAR file: It contains the whole source code with some comments.

Hardie82 wrote:If I tried to use the following code I got a StackOverflowError:

String ooExeFolder = "C:\\Programme\\OpenOffice.org 2.4\\program\\";

First: Use this instead:
Code: Select all   Expand viewCollapse view
String oooExeFolder = "C:/Programme/OpenOffice.org 2.4/program/";

The example from the first post in this tread is working on Windows without double backslashes.

Hardie82 wrote:this.xContext = BootstrapConnector.bootstrap(ooExeFolder, "", "");

Second: Use this much simpler code from the first post in this tread instead:
Code: Select all   Expand viewCollapse view
XComponentContext xContext = BootstrapSocketConnector.bootstrap(oooExeFolder);

Or take a look into the JAR file and use the appropriate parameters.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby Hardie82 » Fri Oct 24, 2008 4:20 pm

After using the BoostrapSocketConnector all works fine. Thanks a lot. But there is still a question. After writing my document and saving it to disk the oo-process is still alive. Is there a way to stop it?
OOo 2.3.X on Ms Windows XP
Hardie82
 
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Fri Oct 24, 2008 6:18 pm

Hardie82 wrote:After using the BoostrapSocketConnector all works fine. Thanks a lot.

That was the reason for providing the example with BoostrapSocketConnector in the first post of this thread ;-)

Hardie82 wrote:But there is still a question. After writing my document and saving it to disk the oo-process is still alive. Is there a way to stop it?

As long as you don't terminate OOo, that process keeps running. Terminating OOo stops your process, too.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby Hardie82 » Mon Oct 27, 2008 9:12 am

Ahh, okay. Is there the possibility to open one time a process and reuse this process without starting a new one? So I only have one oo-process running?

BTW: how do I terminate an oo-process?
OOo 2.3.X on Ms Windows XP
Hardie82
 
Posts: 5
Joined: Fri Oct 24, 2008 3:08 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Mon Oct 27, 2008 9:16 pm

Hardie82 wrote:Is there the possibility to open one time a process and reuse this process without starting a new one? So I only have one oo-process running?

Sure, that is possible. Write your own OOoService which starts OOo and does all the stuff you need OOo for (like a document conversion) and call it whenever you need it. Call it for example through a synchroniced method to serialize all of OOo's actions.

Hardie82 wrote:BTW: how do I terminate an oo-process?

Take a closer look at these threads for example:
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby hbagchi » Thu Oct 30, 2008 6:12 am

While things are working as explained here, I see the open office UI window popping up every time when I use
either the convertWithStaticConnector() or the convertWithConnector() method in the attached example BootstrapSocketConnectorExample. I have provided additional options like -headless. Still the oo UI window is popping up every time I fire a conversion. Moreover, with the convertWithStaticConnector() method once the window opens up it stays that way and does not close as it does for the other option. Although, if I use the JODConverter 2.2.1 library and start openoffice as a service with the headless options, no UI window is popping up.
Of course the latest released version of JODConverter does not support the docx format.

Any idea what is going wrong?

Cheers,
Hitesh
OOo 3.0.X on Ms Windows XP
hbagchi
 
Posts: 3
Joined: Mon Oct 27, 2008 7:41 am

Re: [Java solution] "no office executable found!"

Postby jeffpk » Sat Nov 01, 2008 4:24 am

Hi,

Im trying to use this to get the Netbenas plugin to work on mac OSX 10.5

It got rid of my big exception trace, but I still ge this error on run of the skeleton prgoram:

com.sun.star.lib.loader.Loader::getCustomLoader: exec unoinfo: java.io.IOException: Cannot run program "${office.program.dir}/unoinfo": error=2, No such file or directory

Any idea what might be causing that??
OOo 3.0.X on Mac OSx Leopard
jeffpk
 
Posts: 18
Joined: Fri Oct 31, 2008 5:43 pm

Re: [Java solution] "no office executable found!"

Postby hol.sten » Sat Nov 01, 2008 8:55 am

jeffpk wrote:Im trying to use this to get the Netbenas plugin to work on mac OSX 10.5

It got rid of my big exception trace, but I still ge this error on run of the skeleton prgoram:

com.sun.star.lib.loader.Loader::getCustomLoader: exec unoinfo: java.io.IOException: Cannot run program "${office.program.dir}/unoinfo": error=2, No such file or directory

Any idea what might be causing that??

Reading this thread viewtopic.php?f=20&t=11555, you got it working?
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
hol.sten
Volunteer
 
Posts: 491
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [Java solution] "no office executable found!"

Postby zebulon » Thu Nov 06, 2008 7:21 pm

I am having problems getting rid of the error, perhaps someone could help me. When using the method described here my code works fine in Eclipse, but does not work when I deploy my code to Tomcat 6. I am currently using Fedora 9 and OpenOffice 2.4. Does anyone have any advice?
OOo 2.4.X on Fedora 9
zebulon
 
Posts: 3
Joined: Thu Nov 06, 2008 7:18 pm

Next

Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests