I am trying to compile over a 1000 files within the javac task within ant
and the reply that I am getting back said that I had run out of memory

msg =
    [javac] Compiling 1213 source files to D:\ECM_EXTRAS\ANT1.4\classes
    [javac] The compiler has run out of memory.  Consider using the "
-J-mx<number>" command line option to increase the
maximum heap size.

I then used the memoryMaximumSize option on the javac command within ant
and got the following;

    [javac] Compiling 1213 source files to D:\ECM_EXTRAS\ANT1.4\classes
    [javac] -J-Xmx1000m is an invalid option or argument.
    [javac] Usage: javac <options> <source files>
    [javac] where <options> includes:
    [javac]   -g                     Generate all debugging info
    [javac]   -g:none                Generate no debugging info
    [javac]   -g:{lines,vars,source} Generate only some debugging info
    [javac]   -O                     Optimize; may hinder debugging or
enlarge class files
    [javac]   -nowarn                Generate no warnings
    [javac]   -verbose               Output messages about what the
compiler is doing
    [javac]   -deprecation           Output source locations where
deprecated APIs are used
    [javac]   -classpath <path>      Specify where to find user class files
    [javac]   -sourcepath <path>     Specify where to find input source
    [javac]   -bootclasspath <path>  Override location of bootstrap class
    [javac]   -extdirs <dirs>        Override location of installed
    [javac]   -d <directory>         Specify where to place generated class
    [javac]   -encoding <encoding>   Specify character encoding used by
source files
    [javac]   -target <release>      Generate class files for specific VM

Then I tried the -v flag and got a big output I have trimmed to what I
think is relevant.

Ant version 1.4 compiled on October 10 2001
Buildfile: build.xml
Detected Java version: 1.2 in: D:\ECM_Extras\jdk1.2.2_006\jre
Detected OS: Windows NT
parsing buildfile D:\ECM_EXTRAS\ant1.4\cmp\build.xml with URI =
Project base dir set to: D:\ECM_EXTRAS\ant1.4\cmp
 [property] Override ignored for ant.java.version
Build sequence for target `init' is [init]
Complete build sequence is [init]

    [javac] Compiling 1213 source files to D:\ECM_EXTRAS\ANT1.4\classes
    [javac] Using classic compiler
    [javac] Compilation args: -J-Xmx5000000 -d D:\ECM_EXTRAS\ANT1.4\classes
-classpath D:\ECM_EXTRAS\ANT1.4\classes;D:\E
nt1.4\ecm -sourcepath D:\ECM_AREAS\jamjar\JJ_sourcecode\java -g:none

I tried the memoryMaximumSize  at the beginning and at the end of the javac
task in the build file and it did not make a difference.

Just to make sure I wasn't going mad I tried the command on a single file
just to make sure the syntax was correct.

D:\ECM_EXTRAS\ant1.4\cmp>javac -J-Xmx50000000  *.java
RVWCarConstants.java:17: Package com.quidnunc.fj.common.constant not found
in import.
import com.quidnunc.fj.common.constant.*;

It came back as I expected.

I tried the bug

Direct Line Group Services Limited, registered in England no.3001989, registered 
office 3 Edridge Road, Croydon, Surrey, CR9 1AG.  The following are also members of 
the Direct Line group of companies: Direct Line Insurance plc, a member of the General 
Insurance Standards Council and Direct Line Life Insurance Company Limited and Direct 
Line Unit Trusts Limited, both regulated by the Financial Services Authority.

Reply via email to