[Solved] Setting up SDK for JAVA

The Application Programming Interface and the OASIS Open Document Format

[Solved] Setting up SDK for JAVA

Postby beakhole » Thu Feb 28, 2019 2:37 am

Followed the guide here: https://api.libreoffice.org/docs/install.html and here: http://openofficejava.blogspot.com/2009 ... g-api.html

But can't seem to get it to work, java just doesn't think the UNO API classes exist and I can't compile any scripts I write (IE I get error "package com.sun.star.uno does not exist" on compilation).

I installed the SDK and used the batch file, feeding it paths to everything it wanted. Then I checked my environment variables, but none had been added, so I manually added them all. Still get the same error, as if the SDK does not exist. Am I missing a step?
Last edited by beakhole on Thu Feb 28, 2019 11:24 pm, edited 1 time in total.
OpenOffice 4 on Windows 10
beakhole
 
Posts: 8
Joined: Thu Feb 07, 2019 10:43 pm

Re: Setting up SDK for JAVA

Postby Villeroy » Thu Feb 28, 2019 1:46 pm

I don't program Java but I think you need a 32-bit SDK because AOO for Windows is a 32-bit application.
LibreOffice is availlable as a 64-bit application for MS Windows.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27113
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Setting up SDK for JAVA

Postby beakhole » Thu Feb 28, 2019 5:07 pm

Tried using LibreOffice 64 bit and quite a few different versions of Java, nothing works. To create a .NET app all I had to do was include the CLI dll files (from the SDK) in the project and it worked great instantly, but I wanted to try making a Java version so I could also potentially run it on Linux, but I can't even get started
OpenOffice 4 on Windows 10
beakhole
 
Posts: 8
Joined: Thu Feb 07, 2019 10:43 pm

Re: Setting up SDK for JAVA

Postby Villeroy » Thu Feb 28, 2019 9:07 pm

Can you use any Java features with your office suite?
For instance, can you download (save for editing), open this database document and then open contained tables and queries? The document contains a JDBC database.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27113
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Setting up SDK for JAVA

Postby beakhole » Thu Feb 28, 2019 10:40 pm

So couldn't say why this works, but I went ahead and installed Eclipse along with this plugin (https://github.com/LibreOffice/loeclipse). I don't know why it works, because the plugin appears to just add the LO libraries into the project and start you off with a base script, but it does work. I had the exact same libraries added to a NetBeans project before trying it and it had the same error as in original post and wouldn't work, but with that plugin in Eclipse it does seem to work.
OpenOffice 4 on Windows 10
beakhole
 
Posts: 8
Joined: Thu Feb 07, 2019 10:43 pm

Re: Setting up SDK for JAVA

Postby Villeroy » Thu Feb 28, 2019 11:11 pm

Thank you for posting your solution. Very much apprechiated. The Document Foundation changed a lot of things to make LO more developer friendly. Less frameworks, less dependencies, less overhead, modern tools and sharing platforms. If only the changes on the user side could be as consistent as the changes on the dev side.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27113
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Setting up SDK for JAVA

Postby beakhole » Thu Feb 28, 2019 11:23 pm

I'm sure I must have missed something silly, but I have been repeating the guides over and over and pulling my hair out without success until that Eclipse plugin somehow made it work. Glad it works, but wish I knew why!
OpenOffice 4 on Windows 10
beakhole
 
Posts: 8
Joined: Thu Feb 07, 2019 10:43 pm

Re: [SOLVED?]Setting up SDK for JAVA

Postby Villeroy » Thu Feb 28, 2019 11:34 pm

Next day it will be as obvious as the rising sun.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27113
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Setting up SDK for JAVA

Postby bradleyross » Sat Sep 07, 2019 9:30 pm

How are you referencing the required jar files. I am using Eclipse with Maven on MacOS and have the following POM file. Note the references to juh, unoil, ridl, and jurt. Are these the jar files that you are missing? Would it help if I put my progress so far on GitHub?

Code: Select all   Expand viewCollapse view
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>
  <groupId>bradleyross</groupId>
  <artifactId>libreoffice-tools</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>LibreOfficeTools</name>
  <description>Example code for manipulating LibreOffice ODF files</description>
  <build>
      <plugins>
          <plugin>
              <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-compiler-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-jar-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-site-plugin</artifactId>
           </plugin>
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-javadoc-plugin</artifactId>
           </plugin> 
      </plugins>
  </build> 
 
  <dependencies>
     <dependency>
        <groupId>org.libreoffice</groupId>
        <artifactId>juh</artifactId>
        <version>6.2.3</version>
     </dependency>
     <dependency>
        <groupId>org.libreoffice</groupId>
        <artifactId>unoil</artifactId>
        <version>6.2.3</version>
     </dependency>     
      <dependency>
        <groupId>org.libreoffice</groupId>
        <artifactId>ridl</artifactId>
        <version>6.2.3</version>
     </dependency>    
    <dependency>
        <groupId>org.libreoffice</groupId>
        <artifactId>jurt</artifactId>
        <version>6.2.3</version>
     </dependency>   
  </dependencies>
</project>
Last edited by robleyd on Sun Sep 08, 2019 2:09 am, edited 1 time in total.
Reason: Added Code tags
I am using version 6.0.4.2 of LibreOffice on MacOS Mojave (version 10.14.6)
bradleyross
 
Posts: 3
Joined: Thu Aug 29, 2019 7:55 pm


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest