Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » problem loading native library (OpenOffice API)
problem loading native library (OpenOffice API) [message #663336] Mon, 04 April 2011 16:55
No real name is currently offline No real nameFriend
Messages: 2
Registered: December 2010
Junior Member
Dear all,

Can anyone suggest anything here?

I am investigating the (OpenOffice.org) OOo "officebean". There's a section on it in the DevGuide: http://wiki.services.openoffice.org/wiki/Documentation/DevGu ide/JavaBean/Configuring_the_Office_Bean. I have managed to get this running with the command line (WXP) ... it's exciting because it runs a normal java program but this is then able to call up OOo apps (Writer etc.) and display them in a JPanel or whatever.

Getting it running in this way needed a bit of experimentation. Finally I worked out that using a .bat file with the following lines got it to work:

cd "%ProgramFiles%\OpenOffice.org 3\Basis\sdk\classes"
java -cp %CP% -Dcom.sun.star.lib.loader.unopath="%UNO_PATH%" com.sun.star.lib.loader.Loader OOoBeanViewer


- "CP" here is long, involving many of the OOo jar files, but also the codebase of the OOoBeanViewer.class file. It was necessary to run this java command from \Basis\sdk\classes\ because this is the codebase of com.sun.star.lib.loader.Loader.class.
- "UNO_PATH" here is "%ProgramFiles%\OpenOffice.org 3\programs". It appears that the OOo system here also uses UNO_PATH for other purposes and this is the only setting which works.

However, it was necessary to copy over officebean.jar from C:\Program Files\OpenOffice.org 3\Basis\program\classes to C:\Program Files\OpenOffice.org 3\program\classes before things would work. NB had to create "\classes" here. Suspicion that OOo devs have perhaps over-complicated the installation directory structure with this version of OOo...

I am now trying to do the same thing from Eclipse and have hit a brick wall. Whatever I try the crucial line in the code produces to an error. The user code line is

aBean.loadFromURL(url, null);


... and the line in the OOo API classes which generates an error is in NativeLibraryLoader

public final class NativeLibraryLoader
/*     */ {
/*     */   public static void loadLibrary(ClassLoader paramClassLoader, String paramString)
/*     */   {
/*  55 */     File localFile = getResource(paramClassLoader, System.mapLibraryName(paramString));
/*  56 */     if (localFile == null)
/*     */     {
/*  59 */       System.loadLibrary(paramString);
/*     */     }
/*     */     else System.load(localFile.getAbsolutePath());
/*     */   }

Specifically it is line 59 here: and the error trace printed out is

cannot find msvcr70
cannot find uwinapi

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no officebean in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
...


Naturally enough I have tried including lots of different locations in the java library, and the class path, and I have printed out all the System.getProperties() both during the (successful) command line runs and during the Eclipse runs. There is indeed a file called "uwinapi.dll" under \OpenOffice.org 3, and if you rename this the command line run comes to grief, so it must be using it. However, puzzlingly, there is no "msvcr70.dll" under \OpenOffice.org 3. Or anywhere on my system.

Furthermore, it is a mystery to me why System.loadLibrary() can't ever seem to find uwinapi.dll during the Eclipse run. I have tried changing the codebase of the Eclipse run. I have compared every single setting as printed out from System.getProperties()... and I'm stumped.

Naturally enough I have tried Googling for a solution. A few hardy souls have tried to get OOoBeanViewer running in Eclipse. All have this problem. None has the solution.

All suggestions welcome.

[Updated on: Mon, 04 April 2011 16:56]

Report message to a moderator

Previous Topic:Help Java Not Responding
Next Topic:Eclipse Html
Goto Forum:
  


Current Time: Fri Mar 29 01:46:47 GMT 2024

Powered by FUDForum. Page generated in 0.04437 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top