It took me a moment to figure out which "value" Jim was talking about, so
I'll just clarify that he meant the "mainclass" property should have the
value "hello".  The name of the class is "hello", so that's what you should
be asking <java> to run.

K.C.

> -----Original Message-----
> From: Jim Cheesman [mailto:[EMAIL PROTECTED]]
> Sent: Monday, April 16, 2001 9:37 AM
> To: [EMAIL PROTECTED]
> Subject: Re: basic hello world classpath problem
> 
> 
> 
> >
> >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"/>
> 
> 
> try value="hello"
> 
> Although you should really follow the naming convention from 
> Sun - i.e. 
> Class names start with capital letters! (Which could be in 
> part the problem 
> - what's the file name and class name? Does ant compile the 
> file correctly? 
> Can you run it on the command line?)
> 
> 
> 
> 
> >   <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
> >
> >
> 
> 
> --
> 
>                            *   Jim Cheesman   *
>              Trabajo: [EMAIL PROTECTED] - (34)(91) 724 9200 x 2360
>                Personal: [EMAIL PROTECTED] (34) 606 770 244
>               Practice safe eating -- always use condiments.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

Reply via email to