Good Afternoon Stephan,
We managed to solve the problem. We do not know if it is the most suitable
solution, but for now it worked.
Following, new sample project now a project with a Java Web and a JNLP
application.
https://dl.dropboxusercontent.com/u/30314039/JavaCallLibreOfficeWeb.rar
Well, I'll explain the workings ...
We are using a old applet and not the JNLP, made an adaptation, almost
simulating a JNLP.
The initial method of the applet calls the method "downloadAndInject()" ...
- This makes the applet open a http connection to the server (through a
servlet) and make the download of the required DLLs and JARS for execution.
- They are written in a user directory and then we create a ClassLoader that
will knows that paths.
- This classloader is injected into Java classloaders and this libs become
available, as they would be if there was a statement classPath.
(A solution is complicated, and not recommended, we want to leave, but .. it
works.)
Well, a next step is the Start method of the applet and it performs
basically two steps.
1 - Start OpenOffice - method "initOpenOffice ()"
Starts soffice from the command line with some parameters.
2 - Call a Text Editor - "new WriterEditor (destFilePath)"
It is just getting all the logic directly in the constructor ...
Well, it creates a ooBean and a frame in "StartUI()" and then is called the
swriter in method "loadDocument ()"
To run the test simply turn the project into a web container such as Tomcat
and access the application ..
http://localhost:8080/JavaCallLibreOfficeWeb/
The main index is loaded with jnlp "libre.nocache.jnlp" that is in the
folder: WebContent / applets / .. This folder is also the jar applet
"checkout.jar" that is generated with ant "buildApplet.xml" that lives in
the ant folder.
Currently as I said, we can fix, or work around the problem.
Ubuntu occurred in an error saying that the library officebean could not
find or load the library "libjawt.so" that comes with java.
"java.lang.UnsatisfiedLinkError: /home/gha/myapp/lib/libofficebean.so:
libjawt.so: cannot open shared object file: No such file or directory"
What we did was take this lib and put together the project.
Now besides the jars and we also do "officebean.so" and "libjawt.so"
download and load (with a injection gross)
Now i want some help in some points:
* JNLP - Now we want instead of the old applet, use the JNLP really, but we
can not load library (dll or .so), even if it is inside a jar that stated in
resources (currently commented lines or unused)
Maybe, if we use a normally resources from JNLP and can load officebean .dll
or .so , the problem whit libjawt will not occur.
* Path Installation LibreOffice on LInux - On Linux unable to use the class
SWT Program to find the program use. Odt and then find your installation
path (like we use on windows). How can we find the installation path of the
program that is opening the files by default?
* Libre 3.6 and 4.0, we found that some parameters are not used anymore in
new versions, such as "-- bean", which recommendation? and how can we
differentiate these versions of old?
* Time wait for soffice starts - we need take a Thread.sleep(5000) for wait
soffice really starts .. sometimes when try to call swriter this says that
no have soffice connection .. have another code we can use ? like a while
"is connected " or another ?
Fernando Gomes | Dev. Manager
Skype: fernando.h.gomes
Twitter: fhgomes_ti
-----Mensagem original-----
De: Stephan Bergmann [mailto:sbergman@redhat.com]
Enviada em: sexta-feira, 10 de maio de 2013 04:05
Para: Fernando Digitaldoc
Cc: libreoffice@lists.freedesktop.org
Assunto: Re: RES: Problem Trying call LibreOffice from Java
On 05/09/2013 01:35 AM, Fernando Digitaldoc wrote:
We will make another example. (have some problems with officebean.dll
and officebean.so .. , we are solving for the example) But now , we
are trying to make more tests.
The most critical issue now is the call from Ubuntu.
KDE on Windows or Linux, we can run, but in Ubuntu, after calling the
main screen soffice when we execute the call:
"aBean.startOOoConnection (" uno: socket, host = 127.0.0.1, port =
8100; urp; StarOffice.ServiceManager ");"
He says that the libreoffice.so not find or run libjawt.so "
java.lang.UnsatisfiedLinkError:
/home/gha/myapp/lib/libofficebean.so: libjawt.so: cannot open shared
object
file: No such file or directory"
"/home/gha/myapp/lib/libofficebean.so " - is path were we download
that lib and load that in the applet..
What I can try to solve UnsatisfiedLinkError ?
Such problems are hard to diagnose "into the blue," without a complete (yet
minimal), working example (with instructions how to produce from source).
If you can give us that, somebody with a Ubuntu box might have a look,
Stephan
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.