UNO with Libreoffice 5 (64-Bit, Win) and Java

Hello,

My little Java program uses Libreoffice's (Openoffice's) API named UNO to talk to an installation of the new Libreoffice Version 5 (5.0.0.5).

Under Ubuntu Linux, the Java programs runs in a 64-Bit Java Virtual Machine (JVM) and happily talks via UNO to Libreoffice 64-Bit to use some Libreoffice functions.

However under Windows (64-Bit) with a Libreoffice 64-Bit installation, when I use a 64-Bit JVM to run the same Java program, it results in a Libreoffice error message (i.e. it's not a Java-UNO error) saying something like:
"Libreoffice 5.0 : The application can't be started. An internal error occurred."

(Freely translated from my localised error message which is:
„Libreoffice 5.0 : Die Anwendung kann nicht gestartet werden. Ein interner Fehler ist aufgetreten.“ )

So under Windows I've to fall back to a 32-Bit JVM and a Libreoffice 32-Bit installation. Then I can use the very same Java program in a 32-Bit JVM to talk with Libreoffice 32-Bit.

However, I'd very much like to use a 64-Bit JVM under Windows, too. Is this possible somehow with the new Libreoffice 64-Bit for Windows?

P.S. My Java UNO program uses these four JAR files in the "Libreoffice5.0/program/classes" folder: juh.jar , jurt.jar , ridl.jar , unoil.jar

It should work. My best bet would be to use the Depends tool to trace execution of your Java program and the processes spawned from it, and see whether there is anything going wrong at the DLL-finding level that causes the spawned soffice.bin to fail.

Salve Stephan,

Thanks for your kind reply. I too thought it should work, but to my disappointment it doesn't so far, unfortunately.

The exact same configuration runs however when I use Libreoffice (LO) v5 in 32-Bit being UNO-called from within a JVM 32-Bit. (I'm using the moveable 32-Bit LO version from Portableapps for that purpose, so I can have both the moveable 32-Bit and the installed 64-Bit LO version in one Virtualbox.)

With "Depends tool" do you mean the Depency Walker (depends.exe) ? http://www.dependencywalker.com/
I didn't find another tool which would sound similar to what you mentioned.

In any case, I fail to open my Java program with "Depency Walker", since the latter wants to open "Windows modules" only, i.e. ".exe", ".dll" files.
However I start my Java program with a ".bat" script which the Depency Walker doesn't want to open:
  java -cp myapp.jar;unojarfiles.jar myclass

Do you have any hint please how I could trace my Java program with your mentioned Depends tool?

I'm wondering if anybody ever successfully spawned the brand new LO5 64-Bit on Windows from within Java and UNO?

Greetings,
Aurelius

With "Depends tool" do you mean the Depency Walker (depends.exe) ?
http://www.dependencywalker.com/
I didn't find another tool which would sound similar to what you mentioned.

Yes, that's what I meant.

In any case, I fail to open my Java program with "Depency Walker", since
the latter wants to open "Windows modules" only, i.e. ".exe", ".dll" files.
However I start my Java program with a ".bat" script which the Depency
Walker doesn't want to open:
  java -cp myapp.jar;unojarfiles.jar myclass

Then find the java.exe that would be started by the above batch script, open that in Dependency Walker, and set the "-cp myapp.jar..." arguments when starting java from within Dependency Walker.

Thank you Stephan for the hint. Dependency's profiling the "soffice.bin" execution from within Java worked and I got a longer log.
However, since I'm no C(++) or Windows programmer I wouldn't know where to search for a bug in the Java64->UNO->Libreoffice64 process.

Would somebody like to take a quick look at the log file, please? It's here:
http://pastebin.com/v1x5sEUM

Or are there people in the Libreoffice developer team who know more about this whole UNO thing, in order to spot the error when LO 64-Bit is being called from Java 64-Bit?

Thanks for any help.

Greetings,
Aurelius

My suspicion would be that, when spawned from the java.exe process, soffice.bin runs in some subtly altered environment that e.g. causes it to pick up unexpected instances of certain DLLs---something like picking an MSVCRT DLL that is suitable for the java.exe but not for soffice.bin, or similar.

However, I at least cannot spot any obvious issue in your pastebin, unfortunately.

Stephan, thanks for your help.

If my batch script which starts the Java program, starts an invisible Libreoffice64 instance first (--invisible or such), maybe I find a way to just connect to that running instance from within Java64. So I would bypass the spawning of a Libreoffice64 instance from within Java64, which doesn't work so far.

We'll see. In any case, thanks for your friendly efforts. All the best.

Greetings,
Aurelius