OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

BootstrapException "no office executable found!"
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
openoffice2006
Newbie
Newbie


Joined: 12 Mar 2006
Posts: 3

PostPosted: Sun Mar 12, 2006 11:28 am    Post subject: BootstrapException "no office executable found!" Reply with quote

Hi,

I have installed OpenOffice 2.0 und Windows XP within Eclipse using Java 5.0.

I tried to run the sample code example SWriter.java from the Sun StarOffice_8_SDK
Code:
 public static void main(String args[]) {
       
         com.sun.star.uno.XComponentContext xContext = null;
           
        try {
            // get the remote office component context
            xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();
            if( xContext != null )
                System.out.println("Connected to a running office ...");
        }
        catch( Exception e) {
            e.printStackTrace(System.err);
            System.exit(1);
        }
}


, but I always got the following exception:

Code:
com.sun.star.comp.helper.BootstrapException: no office executable found!
   at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:253)
   at test.SWriter.main(SWriter.java:67)


when it reached the line:
Code:
 xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();


I have also tried to set the Openoffice program path, i.e.
Quote:
c:\programs\OpenOffice.org 2.0\program
within Eclipse. The first time when I have added this path to the Eclipse project, I got a connection and the program run. But for all other following runs, Eclipse denotes to have Errors.

Does anyone know why the bootstrap method does not find my openoffice program, or where I could set the openoffice program path such that I can run my program not only once?

Bye
MG
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Sun Mar 12, 2006 12:29 pm    Post subject: Re: BootstrapException "no office executable found!&quo Reply with quote

openoffice2006 wrote:
but I always got the following exception:

Code:
com.sun.star.comp.helper.BootstrapException: no office executable found!
   at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:253)
   at test.SWriter.main(SWriter.java:67)


when it reached the line:
Code:
 xContext = com.sun.star.comp.helper.Bootstrap.bootstrap();

Question: Did you copy the OOo jar files to a new location or does your Eclipse project reference the OOo jar files directly where the OOo installer put them? I stumbled over the same error once after I copied some of the OOo jar files to a new location before I made references to them from my Eclipse project.

Question: Do you get the same error if you start OOo (in listen mode) before you start your Java application via Eclipse?

With kind regards
hol.sten
Back to top
View user's profile Send private message
manutudescends
General User
General User


Joined: 21 Nov 2005
Posts: 25
Location: Toulouse, France

PostPosted: Mon Mar 13, 2006 2:03 am    Post subject: Reply with quote

is an eclipse RCP aplication?


i have the same problem in eclipse RCP application.
The real problem is that Eclipse( the EclipseClassLoader ) isn't available to load soffice.exe because c:Program file/OpenOffice/ is not in the class path.
A solution is to change in Boostrap class the CLassLoader.
You can use: om.sun.star.lib.unoloader.UnoClassLoader.
Back to top
View user's profile Send private message
openoffice2006
Newbie
Newbie


Joined: 12 Mar 2006
Posts: 3

PostPosted: Mon Mar 13, 2006 11:53 am    Post subject: Reply with quote

Hi,

My problem was that I have copied the required jar files instead of referencing the OOo jar files directly where the OOo installer has put them?

Now it works fine.

Thank you all for your soon replies!

Bye
MG
Back to top
View user's profile Send private message
beat.wuethrich
Newbie
Newbie


Joined: 15 Mar 2006
Posts: 2

PostPosted: Wed Mar 15, 2006 5:56 am    Post subject: Reply with quote

manutudescends wrote:
is an eclipse RCP aplication?


i have the same problem in eclipse RCP application.
The real problem is that Eclipse( the EclipseClassLoader ) isn't available to load soffice.exe because c:Program file/OpenOffice/ is not in the class path.
A solution is to change in Boostrap class the CLassLoader.
You can use: om.sun.star.lib.unoloader.UnoClassLoader.


I'm trying to get my RCP openoffice integration working since 2 days. Could you create a sample what to change in ClassLoader?
Back to top
View user's profile Send private message
manutudescends
General User
General User


Joined: 21 Nov 2005
Posts: 25
Location: Toulouse, France

PostPosted: Wed Mar 15, 2006 8:27 am    Post subject: Reply with quote

first you should use NativeView
show this thread:
http://www.oooforum.org/forum/viewtopic.phtml?t=32906

second

URL[] jarList = new URL[] {
new File(ooBaseDirectory + "/").toURL(),
new File(ooJarsDirectory + "/juh.jar").toURL()
};

ClassLoader customClassLoader = new URLClassLoader(jarList);

add to Bootstrap class the method Bootstrap(ClassLoader customClassLoader) changing only this:
Code:

 File fOffice = NativeLibraryLoader.getResource(
                  customClassLoader, sOffice );


now Eclipse RCP is available to load soffice.exe.
Back to top
View user's profile Send private message
openoffice2006
Newbie
Newbie


Joined: 12 Mar 2006
Posts: 3

PostPosted: Wed Mar 15, 2006 12:30 pm    Post subject: Reply with quote

Sorry, but it is just a simple java project and I am using Eclipse only as IDE.

Bye
MG
Back to top
View user's profile Send private message
beat.wuethrich
Newbie
Newbie


Joined: 15 Mar 2006
Posts: 2

PostPosted: Wed Mar 15, 2006 11:30 pm    Post subject: Reply with quote

manutudescends wrote:
first you should use NativeView
show this thread:
http://www.oooforum.org/forum/viewtopic.phtml?t=32906

second

URL[] jarList = new URL[] {
new File(ooBaseDirectory + "/").toURL(),
new File(ooJarsDirectory + "/juh.jar").toURL()
};

ClassLoader customClassLoader = new URLClassLoader(jarList);

add to Bootstrap class the method Bootstrap(ClassLoader customClassLoader) changing only this:
Code:

 File fOffice = NativeLibraryLoader.getResource(
                  customClassLoader, sOffice );


now Eclipse RCP is available to load soffice.exe.


thanks very much! will try this today and post a reply...
Back to top
View user's profile Send private message
Teus
Newbie
Newbie


Joined: 24 May 2006
Posts: 3
Location: Utrecht, the Netherlands

PostPosted: Wed Jul 19, 2006 12:05 pm    Post subject: Reply with quote

manutudescends wrote:
first you should use NativeView
show this thread:
http://www.oooforum.org/forum/viewtopic.phtml?t=32906

second

URL[] jarList = new URL[] {
new File(ooBaseDirectory + "/").toURL(),
new File(ooJarsDirectory + "/juh.jar").toURL()
};

ClassLoader customClassLoader = new URLClassLoader(jarList);

add to Bootstrap class the method Bootstrap(ClassLoader customClassLoader) changing only this:
Code:

 File fOffice = NativeLibraryLoader.getResource(
                  customClassLoader, sOffice );


now Eclipse RCP is available to load soffice.exe.


Thanks so much for this explanation. I used this method to start OOo from Java with the juh.jar, jurt.jar, ridl.jar, sandbox.jar and unoil.jar from a different location. All I needed to do was to create a URLClassLoader with in it the path to the directory holding the soffice.exe (or soffice) executable and feed that to the bootstrap method. For a more detailed description, see

http://technology.amis.nl/blog/?p=1284


Greets, Teus
_________________
--

People: "If she weighs the same as a Duck, she's made of wood!"
Sir Bedevere: "And therefore...?"
Back to top
View user's profile Send private message MSN Messenger
Selvanayagam
General User
General User


Joined: 18 May 2009
Posts: 10

PostPosted: Tue Aug 18, 2009 1:00 am    Post subject: no office executable found Reply with quote

Hi,

I am new boy, i have installed openoffice 3.0 and have ubuntu 9.04 desktop edition.

I was trying to run the following code


import com.sun.star.comp.helper.BootstrapException;
import com.sun.star.uno.XComponentContext;
import com.sun.star.comp.helper.Bootstrap;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Main {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
// TODO code application logic here
XComponentContext xComponentContext = Bootstrap.bootstrap();
System.out.println("Connecting to a running office .........!");
} catch (BootstrapException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}

}

}

i have copied the libraries jurt.jar, unoil.jar, ridl.jar and juh.jar in a separate folder and i have added this to the classpath



i always get this error:
19 Aug, 2009 2:17:38 PM openoffice.Main main
SEVERE: null
com.sun.star.comp.helper.BootstrapException: no office executable found!
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:248)
at openoffice.Main.main(Main.java:27)

please help me.
Thanks in advance
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Tue Aug 18, 2009 11:01 am    Post subject: Re: no office executable found Reply with quote

Selvanayagam wrote:
i have copied the libraries jurt.jar, unoil.jar, ridl.jar and juh.jar in a separate folder and i have added this to the classpath

Why did you do that? If you had read this post http://www.oooforum.org/forum/viewtopic.phtml?p=133279#133279 in this thread, you might have seen, that moving OOo's JAR files around causes "com.sun.star.comp.helper.BootstrapException: no office executable found!"! Don't do that. Add the JAR files to the CLASSPATH without moving them around previously.
Back to top
View user's profile Send private message
fasisi
General User
General User


Joined: 10 Apr 2009
Posts: 10

PostPosted: Wed Sep 16, 2009 7:36 pm    Post subject: still 'no office executable found' Reply with quote

hello hol.sten,

i am netbenas user and i am trying to use calc from java.
i have added jurt.jar, unoil.jar, ridl.jar and juh.jar to the classpath, but i still get the

"com.sun.star.comp.helper.BootstrapException: no office executable found!"

can you help me?

thanks
Back to top
View user's profile Send private message
fasisi
General User
General User


Joined: 10 Apr 2009
Posts: 10

PostPosted: Wed Sep 16, 2009 8:02 pm    Post subject: just made improvement but not enough Reply with quote

hello hol.sten,

i just added the open office program's folder to the classpath and it solved the

"com.sun.star.comp.helper.BootstrapException: no office executable found!"

but i still get the same error when i run the jar outside the netbeans. i have tried add the path into the manifest file and it did not work.

any idea?

thank you
Back to top
View user's profile Send private message
hol.sten
Super User
Super User


Joined: 14 Nov 2004
Posts: 3533
Location: Hamburg, Germany

PostPosted: Thu Sep 17, 2009 10:17 am    Post subject: Re: just made improvement but not enough Reply with quote

fasisi wrote:
but i still get the same error when i run the jar outside the netbeans. i have tried add the path into the manifest file and it did not work.

any idea?

Add the previously mentioned OOo JAR files to your classpath. How do you execute your JAR?
Back to top
View user's profile Send private message
fasisi
General User
General User


Joined: 10 Apr 2009
Posts: 10

PostPosted: Fri Sep 18, 2009 9:42 pm    Post subject: Reply with quote

hello hol.sten,

i have added the jars in classpath.
i executed the jar this way:

java -jar OpenOffice001.jar

thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group