Page 1 of 1

[Solved] Eclipse & Win, java does not exist

PostPosted: Wed Feb 17, 2021 3:53 pm
by DavidBo
I try out the FirstUnoContact example. I found all the jar files with 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 -->

   <!-- 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="" />
            <section name="com/sun/star/lib/loader/Loader.class">
               <attribute name="Application-Class" value="" />

   <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 does not exist why?

Re: Eclipse on Windows, java. does not exi

PostPosted: Wed Feb 17, 2021 4:10 pm
by DavidBo
The problem was that OFFICE_HOME in the build script was wrong for windows. It should be the same as OFFICE_ROOT