[Solved] Eclipse & Win, java com.sun.star.uno does not exist

Creating a macro - Writing a Script - Using the API

[Solved] Eclipse & Win, java com.sun.star.uno does not exist

Postby DavidBo » Wed Feb 17, 2021 3:53 pm

I try out the FirstUnoContact example. I found all the jar files with com.sun.star in C:\Program Files (x86)\OpenOffice 4\sdk\classes

I try to build with build.xml

Code: Select all   Expand viewCollapse view
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="FirstUnoContact">
   <presetdef name="javac">
       <javac includeantruntime="false" />
   <!-- The following build script works with a standard installation of OpenOffice 3.0.1
        and OpenOffice SDK 3.0.1 as described in section >Linux RPM-based Installation<
        of the document found at http://download.openoffice.org/common/instructions.html. -->

   <!-- This script is tested with the Eclipse IDE and stand-alone, without any IDE support. -->

   <!-- Paths based on the standard installation of OOo 3.0.1 and OOo SDK 3.0.1 on unix -->
   <property name="OFFICE_ROOT" value="C:/Program Files (x86)/OpenOffice 4" />
   <property name="OFFICE_HOME" value="${OFFICE_ROOT}/basis3.0" />
   <property name="OO_SDK_HOME" value="${OFFICE_HOME}/sdk" />
   <property name="OO_URE_HOME" value="${OFFICE_ROOT}/ure" />

   <target name="init">
      <property name="OUT_DIR" value="${basedir}/build/example1/" />
      <!-- For eclipse we need to set the output folder to this path -->
      <property name="BIN_DIR" value="${basedir}/bin/" />

   <path id="office.class.path">
      <filelist dir="${OFFICE_HOME}/program/classes" files="unoil.jar,jurt.jar,ridl.jar,juh.jar" />

   <fileset id="bootstrap.glue.code" dir="${OO_SDK_HOME}/classes">
         <include name="com/sun/star/lib/loader/*.class" />

   <!-- Since the Eclipse IDE has an incremental compiler build in we do not need
        to run the >compile< target in this case -->
   <target name="compile" depends="init" unless="eclipse.running">
      <mkdir dir="${BIN_DIR}" />
      <javac debug="true" deprecation="true" destdir="${BIN_DIR}" srcdir=".">
         <classpath refid="office.class.path" />

   <target name="jar" depends="init,compile">
      <mkdir dir="${OUT_DIR}" />
      <jar basedir="${BIN_DIR}" compress="true" jarfile="${OUT_DIR}/FirstUnoContact.jar">
         <exclude name="**/*.java" />
         <exclude name="*.jar" />
         <fileset refid="bootstrap.glue.code" />
            <attribute name="Main-Class" value="com.sun.star.lib.loader.Loader" />
            <section name="com/sun/star/lib/loader/Loader.class">
               <attribute name="Application-Class" value="de.ooo.devguide.example1.FirstUnoContact" />

   <target name="all" description="Build everything." depends="init,compile,jar">
      <echo message="Application built. FirstUnoContact!" />

   <target name="run" description="Try running it." depends="all">
      <java jar="${OUT_DIR}/FirstUnoContact.jar" failonerror="true" fork="true">

   <target name="cleanbin" description="Clean all binaries." unless="eclipse.running">
         <fileset dir="${BIN_DIR}">
            <include name="**/*.class" />

   <target name="cleanall" description="Clean all build products." depends="init,cleanbin">
      <delete file="${OUT_DIR}/FirstUnoContact.jar" />


But I get package com.sun.star does not exist why?
Last edited by DavidBo on Wed Feb 17, 2021 4:18 pm, edited 2 times in total.
Apache Open Office 4.1.9 Windows 10
Posts: 27
Joined: Thu Mar 12, 2009 3:57 pm

Re: Eclipse on Windows, java. com.sun.star.uno does not exi

Postby DavidBo » Wed Feb 17, 2021 4:10 pm

The problem was that OFFICE_HOME in the build script was wrong for windows. It should be the same as OFFICE_ROOT
Apache Open Office 4.1.9 Windows 10
Posts: 27
Joined: Thu Mar 12, 2009 3:57 pm

Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests