ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laurel A. Williams" <laurel.willi...@utoronto.ca>
Subject basic hello world classpath problem
Date Mon, 16 Apr 2001 13:26:01 GMT
Hello all,

Sorry to ask something so basic but I just can't seem to get past
the original classpath problem...a simple hello class which
cannot be found according to the build.xml. Perhaps when
someone solves this problem, it  could be added as the "hello world"
example in the manual <grin>.

Summary: class hello located on windows machine in c:\hello
Very simple build.xml which compiles using javac but does
not run (java) due to "main class not found"
What am I missing?

Details of build.xml:
<project name="hello" default="run" basedir="c:\hello">

  <!-- set global properties for this build -->
  <property name="src" value="c:\hello"/>
  <property name="build" value="c:\hello"/>
  <property name="classpath" value="c:\hello"/>
  <property name="mainclass" value="hello.class"/>

  <target name="run" depends="compile">
    <!-- run the java code main -->
    <java classname="${mainclass}">
     <classpath>
      <pathelement path="${classpath}"/>
    </classpath>
   </java>
  </target>

  <target name="compile">
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
 </target>

</project>

Details of hello:
public class hello
{
    public static void main(String args[])
 {

     System.out.println("hello");
 }
}

Details of error:
C:\hello\build.xml:11: Could not find hello.class. Make sure you have it

in your classpath





Mime
View raw message