ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From KC Baltz <KBa...@responsenetworks.com>
Subject RE: basic hello world classpath problem
Date Mon, 16 Apr 2001 13:36:17 GMT
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:jchees@msl.es]
> Sent: Monday, April 16, 2001 9:37 AM
> To: ant-user@jakarta.apache.org
> 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: jchees@msl.es - (34)(91) 724 9200 x 2360
>                Personal: mogrim@arrakis.es (34) 606 770 244
>               Practice safe eating -- always use condiments.
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

Mime
View raw message