[Java solution] "no office executable found!"

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

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

Postby neotello » Mon Mar 15, 2010 8:28 pm

hello everyone,

i know that this problem is very usually, however i can't resolver....
i have all openoffice's jar in the tomcat' classpath, and i have de directory openoffice/program in the path (i can execute soffice.exe from any directory) ...
but when i execute this line "context = Bootstrap.bootstrap();" ..i don't understand...
i pay 10000000$ for any idea....
Windows XP, OpenOffice 3.1 , Java 6
neotello
 
Posts: 1
Joined: Mon Mar 15, 2010 8:12 pm

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

Postby hol.sten » Mon Mar 15, 2010 11:23 pm

neotello wrote:i know that this problem is very usually, however i can't resolver....

What did you try to solve it, if you did try anything?

neotello wrote:i have all openoffice's jar in the tomcat' classpath,

You have them in that classpath without moving them around? My guess is, you moved them around. Don't do that or use the bootstrapconnector.jar from the first post of this thread.

neotello wrote:and i have de directory openoffice/program in the path (i can execute soffice.exe from any directory) ...

YOU can, but YOUR application can not. The Bootstrap class delivered with OOo is pretty dumb: It looks only in two directories for soffice.exe. And it can found soffice.exe only if you DON NOT MOVE OOo's JAR files around!

neotello wrote:but when i execute this line "context = Bootstrap.bootstrap();" ..i don't understand...

See above.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby rumbleme » Fri Apr 02, 2010 12:22 am

I am using NetBeans 6.8 IDE with OpenOffice 3.2 and OpenOffice 3.2 SDK on Mac OS X 10.5.8. However, when I create a new project based on a OpenOffice.org Client Application, and run the generated code I see the following error:

com.sun.star.comp.helper.BootstrapException: no office executable found!
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:246)
at com.example.TestUNOCLI2.main(TestUNOCLI2.java:29)

I have read the replies above but cannot see how I can change NetBeans configuration to resolve this error. Can anyone offer any advice?
OpenOffice 3.2.0 on Mac OS X 10.5.8
rumbleme
 
Posts: 1
Joined: Thu Apr 01, 2010 11:20 pm

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

Postby hol.sten » Fri Apr 02, 2010 10:48 am

rumbleme wrote:I am using NetBeans 6.8 IDE with OpenOffice 3.2 and OpenOffice 3.2 SDK on Mac OS X 10.5.8. However, when I create a new project based on a OpenOffice.org Client Application, and run the generated code I see the following error:

com.sun.star.comp.helper.BootstrapException: no office executable found!
at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:246)
at com.example.TestUNOCLI2.main(TestUNOCLI2.java:29)

This thread does nod cover generated code.

rumbleme wrote:I have read the replies above but cannot see how I can change NetBeans configuration to resolve this error. Can anyone offer any advice?

There is in my opinion no way to cure this problem by changing the NetBeans configuration. You have to edit the generated code to solve your problems. Look there for a line of code like
Code: Select all   Expand viewCollapse view
XComponentContext xContext = Bootstrap.bootstrap();
and change it as described in the first post in this thread 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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby praktikant » Wed Apr 21, 2010 11:08 am

Thank you for the solution.
It works perfectly.
OpenOffice 3.1 on Windows XP
praktikant
 
Posts: 1
Joined: Wed Apr 21, 2010 8:46 am

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

Postby bliteknight » Thu Oct 07, 2010 9:42 pm

Thanks, worked like a charm.
OpenOffice 3.2 on Windows Vista
bliteknight
 
Posts: 1
Joined: Thu Oct 07, 2010 9:39 pm

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

Postby Eberk89 » Thu Nov 11, 2010 2:33 am

Thank you for the solution!
Anyway, I have a big question: I can run my class changing the Bootstrap.bootstrap() command with yours end editing the Ant script(http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/FirstSteps/First_Contact#AntBuildScript) to point at yours jar but, in any case, if an openOffice instance is running (and visible on my desktop) and I lunch my program, it'll create a new OO instance instead of using the existing one! Is this normal or something is wrong with my setup?
OOo 3.2 on Ubuntu 10.04
Eberk89
 
Posts: 12
Joined: Wed Oct 22, 2008 10:32 pm

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

Postby fornane » Thu Nov 18, 2010 4:34 am

hi,
I'm a freshman.And I have a serious problem to ask for your help.Thanks!

My problem is that the "bootstrapconnector.jar" can not work with jdk 1.5 .

Do you have any suggests ?
OpenOffice 3.2 ,windows XP
fornane
 
Posts: 6
Joined: Thu Nov 18, 2010 4:25 am

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

Postby hol.sten » Thu Nov 18, 2010 8:20 pm

fornane wrote:My problem is that the "bootstrapconnector.jar" can not work with jdk 1.5.

Due to which error/exception/problem?

fornane wrote:Do you have any suggests ?

Take a look inside the JAR. It contains all the source files. So if you get a Java version conflict compile the source code yourself.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby fornane » Fri Nov 19, 2010 9:17 am

hol.sten wrote:
fornane wrote:My problem is that the "bootstrapconnector.jar" can not work with jdk 1.5.

Due to which error/exception/problem?


the version can not match.

hol.sten wrote:
fornane wrote:Do you have any suggests ?

Take a look inside the JAR. It contains all the source files. So if you get a Java version conflict compile the source code yourself.


OK, I will , thanks.
OpenOffice 3.2 ,windows XP
fornane
 
Posts: 6
Joined: Thu Nov 18, 2010 4:25 am

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

Postby pagran » Tue Jan 11, 2011 10:00 pm

Hol.sten,

Thank you for your contribution. However I cannot get BootstrapSocketConnector working.

The problem is that I get error while script execution:
java.lang.NoClassDefFoundError: ooo/connector/BootstrapSocketConnector

Java project is builded ok, but throws error when reaching this:
Code: Select all   Expand viewCollapse view
String oooExeFolder = "C:/Program Files (x86)/OpenOffice.org 3/program/";
XComponentContext xLocalContext = BootstrapSocketConnector.bootstrap(oooExeFolder);


My environment is: Windows7, OpenOffice.org 3.2.1, Java 1.6.0_22, IDE: Eclipse.

I have set CLASSPATH system environment variable from Control Panel as follows:
CLASSPATH = C:\Program Files (x86)\OpenOffice.org 3\URE\java\juh.jar;C:\Program Files (x86)\OpenOffice.org 3\URE\java\jurt.jar;C:\Program Files (x86)\OpenOffice.org 3\URE\java\ridl.jar;C:\Program Files (x86)\OpenOffice.org 3\Basis\program\classes\unoil.jar;C:\Program Files (x86)\OpenOffice.org 3\Basis\program\classes\sandbox.jar;C:\Program Files (x86)\OpenOffice.org 3\URE\java\bootstrapconnector.jar;C:\Program Files (x86)\OpenOffice.org 3\URE\java;C:\Program Files (x86)\OpenOffice.org 3\Basis\program\classes;C:

I might missed some tiny thing but I have no idea which one.

I would appreciate any advice.
Thank you.
OpenOffice.org 3.2.1
Windows7
pagran
 
Posts: 4
Joined: Tue Jan 11, 2011 9:19 pm

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

Postby hol.sten » Wed Jan 12, 2011 12:11 am

pagran wrote:Thank you for your contribution.

Yes, MY contribution.

pagran wrote:However I cannot get BootstrapSocketConnector working.

Did you download MY contribution from the first post of this thread?

pagran wrote:The problem is that I get error while script execution:
java.lang.NoClassDefFoundError: ooo/connector/BootstrapSocketConnector

Where is MY contribution located on your computer?

pagran wrote:I have set CLASSPATH system environment variable from Control Panel as follows: ... C:\Program Files (x86)\OpenOffice.org 3\URE\java\bootstrapconnector.jar...

Did you really put MY contribution in the folder C:\Program Files (x86)\OpenOffice.org 3\URE\java? This is the OOo installation path. At least a quite uncommon location for the bootstrapconnector.jar from the first post of this thread...
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby pagran » Wed Jan 12, 2011 8:53 am

Hol.sten,

Hol.sten wrote:
pagran wrote:However I cannot get BootstrapSocketConnector working.

Did you download MY contribution from the first post of this thread?

Yes, I've downloaded bootstrapconnector.jar right from the first post and proceeded installation as prescribed.

Hol.sten wrote:
pagran wrote:The problem is that I get error while script execution:
java.lang.NoClassDefFoundError: ooo/connector/BootstrapSocketConnector

Where is MY contribution located on your computer?

pagran wrote:I have set CLASSPATH system environment variable from Control Panel as follows: ... C:\Program Files (x86)\OpenOffice.org 3\URE\java\bootstrapconnector.jar...

Did you really put MY contribution in the folder C:\Program Files (x86)\OpenOffice.org 3\URE\java? This is the OOo installation path. At least a quite uncommon location for the bootstrapconnector.jar from the first post of this thread...


bootstrapconnector.jar is located exactly in C:\Program Files (x86)\OpenOffice.org 3\URE\java on my computer.
I have tried to change the location and adjusted CLASSPATH variable to the new location, but it does not help.
OpenOffice.org 3.2.1
Windows7
pagran
 
Posts: 4
Joined: Tue Jan 11, 2011 9:19 pm

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

Postby RoryOF » Wed Jan 12, 2011 10:15 am

Have you restarted your computer since making the change?
Apache OpenOffice 4.1.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31448
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

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

Postby pagran » Wed Jan 12, 2011 10:30 am

RoryOF wrote:Have you restarted your computer since making the change?

Yes, I restart computer each time change environment.
I suspect that Eclipse IDE does not recognize CLASSPATH variable. Have no idea why.
OpenOffice.org 3.2.1
Windows7
pagran
 
Posts: 4
Joined: Tue Jan 11, 2011 9:19 pm

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

Postby hol.sten » Wed Jan 12, 2011 11:49 pm

pagran wrote:I suspect that Eclipse IDE does not recognize CLASSPATH variable. Have no idea why.

Sorry, I overlooked the detail of your post that you are using Eclipse. And even if I had noticed it, I wouldn't have suspected that anyone would think that setting the classpath would matter to Eclipse.

Eclipse can handle a lot of projects at once. So you have to adjust the classpath in every single project. Open your Eclipse and right-click on your OOo project. Select from the context menu "Properties" and than "Java Build path". Register all your JAR files in the tab "Libraries". That should help.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby pagran » Thu Jan 13, 2011 2:01 pm

hol.sten wrote:And even if I had noticed it, I wouldn't have suspected that anyone would think that setting the classpath would matter to Eclipse.

I am a newbie to Java. Thanks for making these things clear.

hol.sten wrote:Eclipse can handle a lot of projects at once. So you have to adjust the classpath in every single project. Open your Eclipse and right-click on your OOo project. Select from the context menu "Properties" and than "Java Build path". Register all your JAR files in the tab "Libraries". That should help.

That does not help. I think my Eclipse copy is somewhat unique or I am missing something. I solved my problem by copying all required JARs to the folder where Eclipse puts builded JAR with my project. I realize it is an ugly solution but it works.

Thanks for the participation and sorry for bothering with issues that do not relate to bootstrapconnector.
OpenOffice.org 3.2.1
Windows7
pagran
 
Posts: 4
Joined: Tue Jan 11, 2011 9:19 pm

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

Postby sreedhar.boggarapu » Mon May 02, 2011 6:12 pm

Hi hol.sten,

We are using boostrapconnector.jar to generate the word documents from ODT templates. It's been working great. We use this function of generating the document in a web application when the user clicks on create button. Recently we ran into stuck thread issue when concurrent users try to create the
document. I have been doing research on it on how stuck threads are happening.

The configuration we are using as follows.

String oooAcceptOption = "-accept=socket,"+hostAndPort+";urp; -headless -nofirststartwizard";
String oooConnectionString = "uno:socket,"+hostAndPort+";urp;StarOffice.ComponentContext";

I have couple of doubts as follow which needs your help.

1. We are instantiating the BootstrapConnector class every time we create the document and call connect method which in turn starts the open office server on the port number 8100 all the time. So is it an issue having multiple threads working on the open office? Is there a solution for multiple thread issue? If so, please shed some light on us. Please find the issue logged as follows.

com.sun.star.uno.RuntimeException: socket,host=oshabpmqat.oissystem.com,port=8100;urp already exists
com.sun.star.lang.DisposedException: java.io.IOException: com.sun.star.io.IOException: EOF reached - socket,host=oshabpmqat.oissystem.com,port=8100,localHost=oshabpmqat,localPort=35243,peerHost=oshabpmqat.oissystem.com,peerPort=8100

2. May be it's basic question. My question is when I checked with my infrastructure team, they said open office is running as a daemon at port number 8100. So is it required to start the open office again on the port 8100 in the BootstrapConnector class.Please advice.

3. I completely understand the above issue due to multiple threads. But I am seeing stuck threads as follows which i have no clue how these are happening. Please give your expertise advice on the below.

"[STUCK] ExecuteThread: '39' for queue: 'weblogic.kernel.Default (self-tuning)'" waiting for lock java.lang.Object@eb7700 WAITING

java.lang.Object.wait(Native Method)

java.lang.Object.wait(Object.java:485)

com.sun.star.lib.uno.protocols.urp.urp.writeRequest(urp.java:122)

com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendRequest(java_remote_bridge.java:630)

com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.sendInternalRequest(java_remote_bridge.java:669)

com.sun.star.lib.uno.bridges.java_remote.java_remote_bridge.getInstance(java_remote_bridge.java:569)

com.sun.star.comp.urlresolver.UrlResolver$_UrlResolver.resolve(UrlResolver.java:127)

ooo.connector.BootstrapConnector.getRemoteContext(BootstrapConnector.java:193)

ooo.connector.BootstrapConnector.connect(BootstrapConnector.java:115

Thanks,
Sree
OpenOffice 3 on SunOS
sreedhar.boggarapu
 
Posts: 5
Joined: Mon May 02, 2011 5:45 pm

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

Postby hol.sten » Mon May 02, 2011 6:50 pm

sreedhar.boggarapu wrote:So is it an issue having multiple threads working on the open office?

Generally speaking, as you can read in all OOo forums, OOo has multi threading problems. This problem has been reported and discussed a lot. Even using OOo single threaded OOo crashes or stops working from time to time.

sreedhar.boggarapu wrote:Is there a solution for multiple thread issue?

Prevent them! By doing that, for example simply using a synchronised method in your Java application, some users have to wait longer, but that's much better than getting nothing at all.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby sreedhar.boggarapu » Mon May 02, 2011 7:19 pm

Thanks so much hol.sten for your quick response. I am planning to take the following approach to fix the issue. Please suggest me your opinions.

1. Will start open office on multiple ports and pool the bootstrap connectors.
2. Serve the bootstrap connector from the pool for each thread.
3. when the client disconnect the bootstrap connector, release into pool.
4. periodically check the status of the connectors and recreate them if require.


Thanks,
Sree
OpenOffice 3 on SunOS
sreedhar.boggarapu
 
Posts: 5
Joined: Mon May 02, 2011 5:45 pm

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

Postby hol.sten » Mon May 02, 2011 9:55 pm

sreedhar.boggarapu wrote:Thanks so much hol.sten for your quick response. I am planning to take the following approach to fix the issue. Please suggest me your opinions.

1. Will start open office on multiple ports and pool the bootstrap connectors.
2. Serve the bootstrap connector from the pool for each thread.
3. when the client disconnect the bootstrap connector, release into pool.
4. periodically check the status of the connectors and recreate them if require.

Something with an OOo bootstrapconnector pool might work. But on what type of server are you trying to start several OOo instances on different ports? Simply calling OOo with different ports does normally not create multiple OOo instances.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby sreedhar.boggarapu » Mon May 02, 2011 10:57 pm

Yes. You are exactly correct. I tried. But it is creating only one instance. I tried this in Eclipse with JDk 1.6 on my local windows machine. Production platform is going to be Weblogic application sever running on Sun Solaris?

Do you have any idea how to start multiple instances?

Thanks,
Sreedhar
OpenOffice 3 on SunOS
sreedhar.boggarapu
 
Posts: 5
Joined: Mon May 02, 2011 5:45 pm

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

Postby hol.sten » Mon May 02, 2011 11:16 pm

sreedhar.boggarapu wrote:Yes. You are exactly correct. I tried. But it is creating only one instance. I tried this in Eclipse with JDk 1.6 on my local windows machine. Production platform is going to be Weblogic application sever running on Sun Solaris?

Do you have any idea how to start multiple instances?

I've never done anything like that with OOo 2.x or newer. I gave it once a try with OOo 1.1.4 and it was quite easy to do. But that old approach does not work with OOo 2.x or newer.

I once stumbled over this thread: Multiple installation of OpenOffice 2 in same machine: http://www.oooforum.org/forum/viewtopic.phtml?t=57821
It might work with OOo 3.x, too. Give it a try and post any comments in the mentioned thread.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby sreedhar.boggarapu » Tue May 03, 2011 1:26 am

HI, Sorry for bothering you. One lasts doubt. BootstrapConnector.connect method actually starts the Open Office server.(oooServer.start(oooAcceptOption);).
So does it mean we no need to create a daemon thread in linux on open office server externally to run on some port. Please clarify.
OpenOffice 3 on SunOS
sreedhar.boggarapu
 
Posts: 5
Joined: Mon May 02, 2011 5:45 pm

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

Postby hol.sten » Tue May 03, 2011 6:13 pm

sreedhar.boggarapu wrote:BootstrapConnector.connect method actually starts the Open Office server.(oooServer.start(oooAcceptOption);).

Correct. The OOo Bootstrap method looks for a running OOo instance. If it does not find one, it starts OOo. After finding a running OOo it gets connected.

Give it a try: Disable your deamon so that no OOo is running and start your application. It should work.

You'll find more on OOo's connection mechanisms, how they work and how they differ in these threads:
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby sreedhar.boggarapu » Fri May 13, 2011 4:36 pm

Hi hol.sten, I have a question on XStorable interface. I want to run Open Office server and client programs on different machine. When I uses XStorable.saveAsURL in my client program, it actually saving the file on open office server machine for the given URL. Is there a way to store the document on client program machine? Please suggest.


Thanks,
Sreedhar
OpenOffice 3 on SunOS
sreedhar.boggarapu
 
Posts: 5
Joined: Mon May 02, 2011 5:45 pm

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

Postby hol.sten » Fri May 13, 2011 7:22 pm

sreedhar.boggarapu wrote:Is there a way to store the document on client program machine?

Use XInputStream and XOutputStream like I described it here: http://user.services.openoffice.org/en/forum/viewtopic.php?f=44&t=3801

sreedhar.boggarapu wrote:Please suggest.

Please start your own topics and don't continue to ask questions which are totally of topic to the first post of an already started topic.
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: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

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

Postby sekkuar » Mon May 16, 2011 4:49 pm

[s]Hello, first, let me say that this is a great idea. Because I tried making a subclass of Bootstrap and it didnt work well.

It is working, when i'm compiling with netbeans, but, I want to run my aplication from a .jar

when I tell to netbeans to build the jar, it copy all the jars to /lib
and then, I get the "no office executable found!", even using YOUR bootstrap connection.


I'm pretty sure I followed those steps right, because when I run from the Main.class file, it works just fine.
the problem is running from the jar.

Any ideas?[/s]

edit: Oh, nevermind, it was my own mistake.
I changed the bootstrap on xContext but forgot to change it on the XMultiComponentFactory, now it works just fine.
Thanks so much, it really saved me a lot of work!
OpenOffice 3.3 on Windows 7 Professional
LibreOffice 3.3.3 on Ubuntu 11.04
sekkuar
 
Posts: 3
Joined: Mon May 16, 2011 4:43 pm

Bootstarpp blank on OO 3.2.1

Postby oberoiro » Fri May 20, 2011 10:18 pm

Hi
I have been using your bootstrapping jar for couple years on REHL 5 OO 3.1 on jdk 1.6(32 bit) for bootstrapping to OO to convert a xls formula output to a csv.
Recently I have to migrate to REHl6 OO 3.2.1 on jdk 1.6(64 bit) and on this the the generated output is blank.

List oooOptions = OOoServer.getDefaultOOoOptions();
oooOptions.add("-headless");
oooOptions.add("-invisible");
OOoServer oooServer = new OOoServer(getOooExeFolder(), oooOptions);

// Connect to OOo
BootstrapConnector bootstrapSocketConnector = new BootstrapConnector(oooServer);

//wait until office is started
try {
xRemoteContext = bootstrapSocketConnector.connect();
break;
}
catch (BootstrapException e) {
LOGGER.error("Error Connecting to OO server");
}

LOGGER.info("Connected to a running office ...");

XComponent xInputSpreadsheetComponent=null;
XComponent xTemplateSpreadsheetComponent=null;
XComponent xOutputSpreadsheetComponent=null;
XComponent xDummySpreadsheetComponent=null;

try{
xRemoteServiceManager = xRemoteContext.getServiceManager();
String available = (xRemoteServiceManager != null ? "available" : "not available");

//Get the Desktop, we need its XComponentLoader interface to load a new document
Object desktop = xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext);

//Query the XComponentLoader interface from the desktop
xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop);

//create empty array of PropertyValue structs, needed for loadComponentFromURL
PropertyValue[] loadProps = new PropertyValue[0];

//load input file
xInputSpreadsheetComponent = OpenIOFile(FILE+inputFileName,password);
//Checking if the file has actually opened or not
selectSheetByIndex(xInputSpreadsheetComponent, 0);

File file = new File(outputFileName);
if(file.exists()){
file.delete();
}
//create empty file and save it to output file to prevent open from failing
xDummySpreadsheetComponent = xComponentLoader.loadComponentFromURL("private:factory/scalc", "_blank", 0, loadProps);
storeDocComponent(xDummySpreadsheetComponent,FILE+outputFileName,MS97);
xDummySpreadsheetComponent.dispose();



//load template file
xTemplateSpreadsheetComponent = xComponentLoader.loadComponentFromURL(FILE+templateFileName, "_blank", 0, loadProps);

CopySheetContentsSpecial (xInputSpreadsheetComponent, 0, xTemplateSpreadsheetComponent, 0);



//load output file
xOutputSpreadsheetComponent = OpenIOFile(FILE+outputFileName,"");
CopySheetContentsSpecial (xTemplateSpreadsheetComponent, 1, xOutputSpreadsheetComponent, 0);
storeDocComponent(xOutputSpreadsheetComponent,FILE+outputFileName,CSV);

//Close All files
xInputSpreadsheetComponent.dispose();
xTemplateSpreadsheetComponent.dispose();
xOutputSpreadsheetComponent.dispose();

I tried with 32 bit java , still doesn't work. Please help.
Ifi start soffice using below, it connects & coverts fine..but if below is not run it starts new instance of soffice but the output is blank
export DISPLAY=:5
OPENOFFICE=/usr/bin/soffice
$OPENOFFICE -norestore
OpenOffice 3.1 on Unix REL 5
oberoiro
 
Posts: 1
Joined: Fri May 20, 2011 10:16 pm

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

Postby dryzen » Tue Jun 07, 2011 9:01 pm

Hi,

and many thanks for that nice ooo.connector. :bravo:
Without that tool, it would have been impossible for me to connect to openoffice 3.3 on windows7.

Unfortunately, on my debian 6 (amd64) VM with distro-openoffice(3) the BootstrapSocketConnector needs about 20 seconds... no matter if soffice is allready running or not, allways about 20 seconds.

Does anyone have any idea what could hang there?
--
Thanks.
OpenOffice 3.3 on Windows 7
dryzen
 
Posts: 1
Joined: Tue Jun 07, 2011 6:59 pm

PreviousNext

Return to External Programs

Who is online

Users browsing this forum: No registered users and 2 guests