0

I am pretty new to Ant but, I have a general understanding. I just cannot get this to work.

<?xml version="1.0"?>
<project name="Ser321 Assignment 3 Java Movie Library with Ant build file and API support."
         default="targets" basedir="."
         xmlns:dn="antlib:org.apache.ant.dotnet"
         xmlns="antlib:org.apache.tools.ant"
         xmlns:cpptasks="antlib:net.sf.antcontrib.cpptasks">

   <property name="src.dir" value="src"/>
   <property name="lib.dir" value="lib" />
   <property name="build" value="classes"/>
   <property name="bin" value="bin"/>
   <property name="obj" value="obj"/>
   <property environment="env"/>
   <property name="user" value="${env.USERNAME}"/>

   <target name="targets">
      <echo message="Targets are clean, prepare, build, execute, and targets"/>
   </target>

   <path id="compile.classpath">
      <pathelement location="${build}"/>
   </path>
   <path id="external.classpath">
      <pathelement location="${lib.dir}/json.jar"/>
   </path>

   <target name="prepare">
      <mkdir dir="${build}" />
      <mkdir dir="${bin}"/>
      <mkdir dir="${obj}"/>
   </target>

   <target name="clean">
      <delete dir="${build}" failonerror="false"/>
      <delete dir="${bin}" failonerror="false"/>
      <delete dir="${obj}" failonerror="false"/>
   </target>

   <target name="build" depends="prepare">
      <javac srcdir="${src.dir}"
             includeantruntime="false"
             destdir="${build}">
         <classpath refid="external.classpath"/>
      </javac>
   </target>

   <target name="execute.jar" depends="build"
           description="Run the program">
         <java classname="Main" fork="yes">
           <classpath refid="compile.classpath"/>
         </java>
   </target>

</project>

This gives me my classes folder with movie as the next folder and then in there, I have my 3 classes. However, it keeps saying class not found and I have no idea what I am doing wrong.

Ruan33
  • 29
  • 8

1 Answers1

0

Figured it out. I am an airhead sometimes.

<target name="execute.jar" depends="build"
       description="Run the program">
     <java classname="movie.Main" fork="yes"> //added movie.main instead of Main
       <classpath refid="compile.classpath"/>
     </java>

Ruan33
  • 29
  • 8