ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vilya Harvey <>
Subject Re: *.java to *.class?
Date Wed, 02 Apr 2003 16:16:13 GMT
Be careful when doing that though: if you have any inner classes, 
anonymous classes, or even if you have any more than one top level class 
in a file anywhere in your code, the additional classes will not be 
picked up. The usual way to do this sort of thing is to specify an 
output directory for the compilation and simply jar up every class file 
in that directory. For example:

    <javac destdir="${classes}" srcdir="${src}" classpathref="myclasspath"/>
    <jar destfile="${jarfile}" basedir="${classes}" includes="**/*.class"/>

Hope that helps,

Keith Hatton wrote:

>I think you need the <mapper> element - look in the Ant docs for File Mappers.
>Something like
><mapper type="glob" from="*.java" to="*.class"/>
>Hope this helps
>-----Original Message-----
>From: Todor Boev []
>Sent: 02 April 2003 16:59
>To: Ant Users List
>Subject: *.java to *.class?
>Hello all,
>Assume I have a fileset that contains some *.java filles. I need to compile all these
java files and than put into a jar their corresponding *.class files. Is there a way to derive
the list of class files from the list of java files and store it all into a fileset or a property?
>Best regards,
>Todor Boev
Vilya Harvey, Consultant                 / digital steps /
(W) +44 (0)1483 469 480                                      
(M) +44 (0)7816 678 457       


This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this email and you are not a named
addressee, please inform the sender at Digital Steps Ltd by phone on
+44 (0)1483 469 480 or by reply email and then delete the email from
your system. If you are not a named addressee you must not use,
disclose, distribute, copy, print or rely on this email. Although
Digital Steps Ltd routinely screens for viruses, addressees should
check this email and any attachments for viruses. Digital Steps Ltd
makes no representation or warranty as to the absence of viruses in this
email or any attachments.

View raw message