Hi,

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 =
compile:
    [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]
    [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
files
    [javac]   -bootclasspath <path>  Override location of bootstrap class
files
    [javac]   -extdirs <dirs>        Override location of installed
extensions
    [javac]   -d <directory>         Specify where to place generated class
files
    [javac]   -encoding <encoding>   Specify character encoding used by
source files
    [javac]   -target <release>      Generate class files for specific VM
version

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 =
file:D:/ECM_EXTRAS/ant1.4/cmp/build.xml
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
CM_Extras\JJlibs\bizui.jar;D:\ECM_Extras\JJlibs\xerces.jar;D:
\ECM_Extras\JJlibs\xalan.jar;D:\ECM_Extras\JJlibs\profiler4
.jar;D:\ECM_Extras\JJlibs\targeting.jar;D:\ECM_Extras\JJlibs\dps.jar;D:
\ECM_Extras\JJlibs\classes.jar;D:\ECM_Extras\JJli
bs\commonui.jar;D:\ECM_Extras\JJlibs\devui.jar;D:
\ECM_Extras\JJlibs\beans.jar;D:\ECM_Extras\JJlibs\core.jar;D:\ECM_Extra
s\JJlibs\common.jar;D:\ECM_Extras\JJlibs\dynamo2.jar;D:
\ECM_Extras\JJlibs\jndiall.jar;D:\ECM_Extras\JJlibs\jgl.jar;D:\EC
M_Extras\JJlibs\mail.jar;D:\ECM_Extras\JJlibs\activation.jar;D:
\ECM_Extras\JJlibs\javax.jts.zip;D:\ECM_Extras\JJlibs\jav
ax.ejb.zip;D:\ECM_Extras\JJlibs\xml4j.jar;D:
\ECM_Extras\JJlibs\lotusxsl.jar;D:\ECM_Extras\JJlibs\classes12_01.zip;D:
\ECM
_Extras\JJlibs\vsearch.jar;D:\ECM_Extras\JJlibs\k2client.jar;D:
\ECM_Extras\JJlibs\fj.jar;D:\ECM_Extras\JJlibs\fj_ejb.jar
;D:\ECM_Extras\JJlibs\finance.jar;D:\ECM_Extras\JJlibs\weblogicaux.jar;D:
\ECM_Extras\JJlibs\jca.jar;D:\ECM_Extras\JJlibs
\jcrypto.jar;D:\ECM_Extras\JJlibs\jssl.jar;D:
\ECM_Extras\JJlibs\SitePay.jar;D:\ECM_Extras\JJlibs\xsu12.jar;D:\ECM_Extras
\JJlibs\streamline.jar;D:\ECM_Extras\JJlibs\moaicls.jar;D:
\ECM_Extras\jdk1.2.2_006\lib\tools.jar;D:\ECM_Extras\ant1.4\di
st\lib\parser.jar;D:\ECM_Extras\ant1.4\dist\lib\optional.jar;D:
\ECM_Extras\ant1.4\dist\lib\jaxp.jar;D:\ECM_Extras\ant1.4
\dist\lib\ant.jar;D:\ECM_Extras\ant1.4\lib\ant.jar;D:
\ECM_Extras\ant1.4\lib\jakarta-ant-1.4-optional.jar;D:\ECM_Extras\a
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