ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Cheesman <jch...@msl.es>
Subject Re: basic hello world classpath problem
Date Mon, 16 Apr 2001 13:36:47 GMT

>
>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