Cedric Bosdonnat wrote:
Hi Hans-Christian,

Stadler Hans-Christian a écrit :

Running the program from the jar file:

[EMAIL PROTECTED] OOUno]$ jar cmf MANIFEST.MF oouno.jar -C bin 
TextExtractor.class
[EMAIL PROTECTED] OOUno]$ jar tf oouno.jar
META-INF/
META-INF/MANIFEST.MF
TextExtractor.class
[EMAIL PROTECTED] OOUno]$ jar xf oouno.jar META-INF/MANIFEST.MF; cat 
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Class-Path: /opt/openoffice.org2.0/program/classes/unoloader.jar /opt/
 openoffice.org2.0/program/classes/juh.jar /opt/openoffice.org2.0/prog
 ram/classes/jurt.jar /opt/openoffice.org2.0/program/classes/ridl.jar
 /opt/openoffice.org2.0/program/classes/unoil.jar

The Class-Path option in a manifest file works only with relative paths. But you don't need it here. Using the simple bootstrap mechanism (described bellow) does it for, internally an own classloader is used to provide all necessary UNO types from the office.

Created-By: 1.5.0_06 (Sun Microsystems Inc.)
Main-Class: TextExtractor
[EMAIL PROTECTED] OOUno]$ java -jar oouno.jar /tmp/test.xls
com.sun.star.comp.helper.BootstrapException: no office executable found!
        at com.sun.star.comp.helper.Bootstrap.bootstrap(Bootstrap.java:253)
        at TextExtractor.main(TextExtractor.java:89)

Did you put the juh.jar file in your jar ? juh.jar needs some OOo C++

wait, you don't need to put juh.jar in your jar.
The SDK contains some glue code which should be integrated in your jar file to use the simple bootstrap mechanism. Furthermore you have to modify your manifest file.

Add the following classes (<sdk>/classes) from the SDK to your jar:
com/sun/star/lib/loader/Loader$CustomURLClassLoader.class
com/sun/star/lib/loader/Loader.class
com/sun/star/lib/loader/InstallationFinder$StreamGobbler.class
com/sun/star/lib/loader/InstallationFinder.class
com/sun/star/lib/loader/WinRegKey.class
com/sun/star/lib/loader/WinRegKeyException.class
win/unowinreg.dll

Modify your manifest:
Main-Class: com.sun.star.lib.loader.Loader

Name: com/sun/star/lib/loader/Loader.class
Application-Class: TextExtractor

To ensure that a preferred office installation is used you can run your application with
java -Dcom.sun.star.lib.loader.unopath=<office_program_path> -jar oouno.jar

If you don't use the -D option the default office is used. But this works only with an office donwloaded from OpenOffice.org (or a mirror) directly. On some Linux distros you can have problems with the office found in /usr/bin or some where else in the PATH.

Juergen




libraries and the soffice program in its program. You would better pack
your classes into a jar (eg: test.jar) and then add it to your
classpasth with the OOo jars.

If you want to make this easier, you can use some shell scripts to avoid
 long commands typing.

Following suggestions from this thread I have tried to use the UnoClassLoader 
and give some extra arguments, but nothing works:

I haven't see there already was a UnoClassLoader: I'll better have to
use it instead of rewriting it: thanks for the idea ;)

Hope that helps,
Cedric

---------------------------------------------------------------------
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]

Reply via email to