ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject RE: How to compile a java file?
Date Thu, 04 Sep 2003 05:42:58 GMT
> I've got a java source file (foo.java) that  I want to compile to get 
> foo.class.  How do I write an ant build.xml file to do this?

<project default="compile">
    <target name="compile">
        <javac srcdir="."/>
    </target>
</project>

placed as build.xml in the directory containing foo.java (if that class 
has no package statement). Starting "ant" from shell.

BTW you should name classes with an upcase letter first: Foo.java (common
code styleguide).



> I'm new to ant (and relatively new to java), so maybe there's 
> something 
> obvious I'm just not seeing.  I read the manual, and while it 
> describes 
> how to do complex things, it doesn't say how to do this most 
> simple and 
> obvious thing.

Yes, that´s written in java books "How to compile my classes".

I have written a small tutorial (damn - forgotten to upload that into cvs)
about writing tasks. If you read the first two chapters you´ll probably
get an idea of how using ant in build environment.

http://nagoya.apache.org/wiki/apachewiki.cgi?AntTutorialWritingTasks


Jan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message