Hi,
It is fine when jars are in original position
Example :
1) create project and add jars from OFFICE_HOME/program/classes in classpath
(no relocate jars, only add in classpath) - It work fine
2) create project, add jars from OFFICE_HOME/program/classes in my project
folder
(relocate it) - add relocated jars in classpath.It compile, load class, but
can't find
officebean libraries (libofficebean.so) - I add
java.library.path=OFFICE_HOME/program
and libofficebean.so is ok, but OOoBean can't find soffice program.I try add
soffice in PATH,
java.library.path,com.sun.star.beans.path without success - OOoBean seek
soffice relative to
jars files - I see NativeClassLoader and it search with loader of class
LocalOfficeConnection
and relative from officebean.jar - I think that loader have to seek in PATH yet
(or OFFICE_HOME)
It is simple add in LocalOfficeConnection#getProgramPath for seek in PATH
(and/or OFFICE_HOME)
With the current design it is not supported that the jar files are
relocated. That is, they must be located in the program/classes
directory. In a sense, the office installation must be regarded as one
entity and hence cannot be split up.
I link soffice to /soffice for check and get InteruptedException
How I can set program location for OfficeBean ?
One could use an UrlClassLoader that knows the location of soffice to
load OOoBean. (never tested that before).
Have a look at LocalOfficeConnection.getProgramPath and
NativeLibraryLoader.getResource.
This not help, because NativeLibraryPath search urls directories (or parent
directories) only
If I relocate jars then it can't find soffice
What I meant is, one could use an own class loader that knows the
location of the office and which loads the class files of your
application. This class loader is passed into the NativeClassLoader:
File path = NativeLibraryLoader.getResource(
LocalOfficeConnection.class.getClassLoader(), aExec);
Then this loader would be asked to get the path to the executable.
My workaround for now is :
make classloader - use OFFICE_HOME env. variable for soffice libraries (add in
path) dynamic and
load OO classes dynamic with this, but I have to use reflection for calling OO
method (I work in eclipse
and can't change classloader on runtime, but OO doesn't use context classloader)
We intent to extend the OOoBean to be used along with the simple
bootstrap mechanism.
There is an example in the SDK:
SDK\examples\DevelopersGuide\ProfUNO\SimpleBootstrap_java
which uses a special loader class to load the application. The loader
class com.sun.star.lib.loader.Loader can be found in the project ODK:
odk\source\com\sun\star\lib\loader\Loader
A description about this bootstrap mechanism can be found in the
Developer's Guide, chapter 3.4.1 "Java Language Binding", sub chapter
"Transparent Use of Office UNO Components"
However the OOoBean must be changed so that it can be passed an
XComponentContext. The advantage would be that one can start the Java
app (must be a jar) without putting all the office jars in the class path.
It is much better that getProgramPath or NativeClassLoader use PATH (and yet
any use variable) for search)
Although this would be possible we once decided that applications must
use the jars from the office installation which is being used (this
allows to have different office installations).
There is yet another problem : I try officebean in KDE and it work fine in KDE,
but when I set
SAL_USE_VCLPLUGIN=gtk it doesn't work - no exception, office start, loadFromURL
work fine,
acquireSystemWindow work without exception but no connection (panel is empty)
I try from gtk environment, but it isn't work , too (I don't test enough this,
because my gnome is compiled
and hard patched - gtk is 2.8.4)
I will put that on the list for testing.
Thanks,
Joachim
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]