I'm having problems on a client's Windows XP system which leads to a
number of questions.
I haven't been closely involved in using the OOo API for a couple years.
I wrote a wrapper class to handle the functions I needed to handle,
then had to move on and have been heavily involved with the other
aspects of my programming work since then.
I have a Java program that works on Linux and Windows that uses OOo.
When my program starts, it tries to connect to OOo. If it can't, it
figures OOo is not running and runs it. Currently I'm using OOo 2.0.2.
I'm not likely to upgrade because dealing with the new installer is
such a pain that unless I spend a day or two verifying everything on
the Windows install, doing a custom install is quite difficult.
I use a script, in both Linux and Windows, to actually run OOo and the
script is called from the Java Runtime class. It's worked well for 2-3
years and now, suddenly I'm having problems with a new Windows XP
install (and I've had many instances of this working on Windows XP).
So far the only difference I can be sure of on this computer is that it
is running Java 6, but I cannot duplicate my problems on my own XP
system with Java 6.
Here's what happens:
If I run my script from the command line, OOo will start up fine. If I
run the same script from Java, OOo won't start. It's that simple.
Here's the script:
SET ooo_file=C:\Program Files\OpenOffice.org2.0\program\soffice
if "%1" == "" "%ooo_file%" -quickstart >nul
if "%1" == "-headless" "%ooo_file%" -headless >nul
if "%1" == "-quickstart" "%ooo_file%" -quickstart >nul
Which I simplified to:
SET ooo_file=C:\Program Files\OpenOffice.org2.0\program\soffice
"%ooo_file%" -quickstart >nul
Again, when run from the command line, it works just fine. Then I run
it in Java, using this:
try {
Runtime.getRuntime().exec(sFile);
} catch (Exception e) {
sysConfig.log("error", "Cannot Run Command (RunFile): " + sFile
+ ", Error: " + e);
TNConfig.printTrace(e);
}
While the functions in the error trapping section are my own, they're
not the issue and when I'm having problems, they're never used, so no
error is thrown when I try this. The script runs (more on that in a
bit), but I don't see an instance of OOo starting.
I replaced ">nul" in the script with a redirect to a file and when the
script is run from Java, I do get a null output file, so I know the
script runs. I was informed that this redirect was sufficient in DOS,
but have just learned that I need "2>filename.txt" to give me the
errors, just as in Linux. I may have time to try that on my client's
system or I may not. I can't keep pestering her to let me use her
computer for debugging since we have a working (but clumsy) solution.
So now my questions:
1) Is there any reason OOo might not start from the environment created
by the Runtime class even though it starts from the command line?
2) Is there an easy way to start OOo from within the Java OOo API? I
don't think there was when I first studied this under 1.x, but I could
have missed something. I'm self taught, so I do have trouble sometimes
with following everything in documentation.
Thanks for any help or insight into this!
Hal
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]