You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by vinothofindia <vi...@yahoo.co.in> on 2009/12/08 02:18:48 UTC
RE: Frequent java.lang.OutOfMemoryError: Java heap space error
Hi,
I have been encountering same issue.
I got "java.lang.OutOfMemoryError: Java heap space" when I tried to compile
my code with ANT.
So, I tried setting ANT_OPTS env var, that doesn't resolve the issue
permanently and the issue occurred intermittently.
Then I tried setting fork attribute in my build.xml, which brought up a
following exception
Error running C:\jdk1.5.0_15\bin\javac.exe compiler
at
org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:537)
at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:301)
at org.apache.tools.ant.Target.performTasks(Target.java:328)
at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
at org.apache.tools.ant.Main.runBuild(Main.java:632)
at org.apache.tools.ant.Main.startAnt(Main.java:183)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
Caused by: java.io.IOException: CreateProcess: C:\jdk1.5.0_15\bin\javac.exe
-J-Xms256m -J-Xmx256m -d C:\target\classes -classpath <classpath>
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:808)
at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
at
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:449)
... 33 more
The javac tag I used in my build.xml is:
<javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
fork="yes"
memoryInitialSize="256m"
memoryMaximumSize="256m"
executable="${env.JAVA_HOME}/bin/javac"
source="${compiler.opts.vm.source}"
target="${compiler.opts.vm.target}"
includes="${projectDir}/xxx/**"
excludes="${projectDir}/xxxTest/**" >
<classpath refid="base.path" />
</javac>
I have even tried with following javac tag in build.xml:
<javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
fork="yes"
memoryInitialSize="512m"
memoryMaximumSize="512m"
executable="${env.JAVA_HOME}/bin/javac"
deprecation="off"
optimize="off"
verbose="no"
source="${compiler.opts.vm.source}"
target="${compiler.opts.vm.target}"
includes="${projectDir}/xxx/**"
excludes="${projectDir}/xxx/Test/**" >
<classpath refid="base.path" />
</javac>
Please help me to get rid of this issue, I have been struggling with this
issue for the last 5 days.
Thanks in advance,
_Vino
kermitt wrote:
>
> have you tried to fork and specify the memoryInitialSize and
> memoryMaximumSize?
>
> you should try with another compiler if you were using Sun Javac, try
> jikes or even better eclipse compiler
> (org.eclipse.jdt.core.JDTCompilerAdapter)
>
> my 2cts...
>
>
>
> -----Original Message-----
> From: Ravi Roy [mailto:ravi.aroy@gmail.com]
> Sent: Monday, December 10, 2007 4:37 PM
> To: user@ant.apache.org
> Subject: Frequent java.lang.OutOfMemoryError: Java heap space error
>
> Hello all,
>
> I am running my product build with cruisecontrol using ant 1.7.0. I have
> set
> ANT_OPTS=-Xms=1536m -Xmx1536m, but still I am getting below mentioned
> error,
> I have searched mail archive, but I see ANT_OPTS settings, which I have
> already set, I get the following error :
>
> [javac] The system is out of resources.
> [javac] java.lang.OutOfMemoryError: Java heap space
>
> Am I doing right to set ANT_OPTS variable to increase the heap size ? I am
> running my build machine using Windows XP with 2.0 Gigabyte of physical
> RAM.
>
> Does somebody know how to handle this ? It is more frequent now.
>
> Thanks in adavnace for thoughts.
>
> Regards,
> Ravi
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/Frequent-java.lang.OutOfMemoryError%3A-Java-heap-space-error-tp14255237p26687265.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Frequent java.lang.OutOfMemoryError: Java heap space error
Posted by vinothofindia <vi...@yahoo.co.in>.
Hi Antoine,
Thanks for your reply.
The "base.path" defined is as given below
<path id="base.path">
<dirset dir="${prd.classes}"/>
<dirset dir="${src}/../tmp/cs/www/classpath"/>
<!-- sdk classes -->
<fileset dir="${prd.lib}">
<include name="**/*.jar"/>
</fileset>
<!-- Third part libraries -->
<fileset dir="${prd.lib.thirdparty}">
<include name="**/*.jar"/>
</fileset>
<!-- JRE libraries -->
<fileset dir="${env.JAVA_HOME}/jre/lib">
<include name="**/*.jar"/>
</fileset>
</path>
Please suggest me what should I have to do?
Thanks,
_Vino
antoinell wrote:
>
>
> Hello Vino,
>
> how is base.path defined in your script ?
>
> Do you have a blurb somewhere looking like
>
> <path id="base.path">
> <fileset dir="lib">
> <include name="*/*.jar"/>
> </fileset>
> </path>
>
> It looks like base.path is replaced at runtime literally with
> "<classpath>"
>
> Regards,
>
> Antoine
>
>
> vinothofindia wrote:
>> Hi,
>>
>> I have been encountering same issue.
>>
>> I got "java.lang.OutOfMemoryError: Java heap space" when I tried to
>> compile
>> my code with ANT.
>> So, I tried setting ANT_OPTS env var, that doesn't resolve the issue
>> permanently and the issue occurred intermittently.
>>
>> Then I tried setting fork attribute in my build.xml, which brought up a
>> following exception
>>
>> Error running C:\jdk1.5.0_15\bin\javac.exe compiler
>> at
>> org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:537)
>> at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
>> at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
>> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
>> at org.apache.tools.ant.Task.perform(Task.java:364)
>> at org.apache.tools.ant.Target.execute(Target.java:301)
>> at org.apache.tools.ant.Target.performTasks(Target.java:328)
>> at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
>> at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
>> at org.apache.tools.ant.Main.runBuild(Main.java:632)
>> at org.apache.tools.ant.Main.startAnt(Main.java:183)
>> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
>> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
>> Caused by: java.io.IOException: CreateProcess:
>> C:\jdk1.5.0_15\bin\javac.exe
>> -J-Xms256m -J-Xmx256m -d C:\target\classes -classpath <classpath>
>> at java.lang.ProcessImpl.create(Native Method)
>> at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
>> at java.lang.ProcessImpl.start(ProcessImpl.java:30)
>> at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
>> at java.lang.Runtime.exec(Runtime.java:591)
>> at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> at java.lang.reflect.Method.invoke(Method.java:585)
>> at
>> org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:808)
>> at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
>> at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
>> at
>> org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:449)
>> ... 33 more
>>
>>
>> The javac tag I used in my build.xml is:
>> <javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
>> fork="yes"
>> memoryInitialSize="256m"
>> memoryMaximumSize="256m"
>> executable="${env.JAVA_HOME}/bin/javac"
>> source="${compiler.opts.vm.source}"
>> target="${compiler.opts.vm.target}"
>> includes="${projectDir}/xxx/**"
>> excludes="${projectDir}/xxxTest/**" >
>> <classpath refid="base.path" />
>>
>> </javac>
>>
>>
>> I have even tried with following javac tag in build.xml:
>> <javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
>> fork="yes"
>> memoryInitialSize="512m"
>> memoryMaximumSize="512m"
>> executable="${env.JAVA_HOME}/bin/javac"
>> deprecation="off"
>> optimize="off"
>> verbose="no"
>> source="${compiler.opts.vm.source}"
>> target="${compiler.opts.vm.target}"
>> includes="${projectDir}/xxx/**"
>> excludes="${projectDir}/xxx/Test/**" >
>> <classpath refid="base.path" />
>> </javac>
>>
>>
>>
>> Please help me to get rid of this issue, I have been struggling with this
>> issue for the last 5 days.
>>
>>
>> Thanks in advance,
>> _Vino
>>
>>
>>
>> kermitt wrote:
>>
>>> have you tried to fork and specify the memoryInitialSize and
>>> memoryMaximumSize?
>>>
>>> you should try with another compiler if you were using Sun Javac, try
>>> jikes or even better eclipse compiler
>>> (org.eclipse.jdt.core.JDTCompilerAdapter)
>>>
>>> my 2cts...
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Ravi Roy [mailto:ravi.aroy@gmail.com]
>>> Sent: Monday, December 10, 2007 4:37 PM
>>> To: user@ant.apache.org
>>> Subject: Frequent java.lang.OutOfMemoryError: Java heap space error
>>>
>>> Hello all,
>>>
>>> I am running my product build with cruisecontrol using ant 1.7.0. I have
>>> set
>>> ANT_OPTS=-Xms=1536m -Xmx1536m, but still I am getting below mentioned
>>> error,
>>> I have searched mail archive, but I see ANT_OPTS settings, which I have
>>> already set, I get the following error :
>>>
>>> [javac] The system is out of resources.
>>> [javac] java.lang.OutOfMemoryError: Java heap space
>>>
>>> Am I doing right to set ANT_OPTS variable to increase the heap size ? I
>>> am
>>> running my build machine using Windows XP with 2.0 Gigabyte of physical
>>> RAM.
>>>
>>> Does somebody know how to handle this ? It is more frequent now.
>>>
>>> Thanks in adavnace for thoughts.
>>>
>>> Regards,
>>> Ravi
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>> For additional commands, e-mail: user-help@ant.apache.org
>>>
>>>
>>>
>>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>
>
--
View this message in context: http://old.nabble.com/Frequent-java.lang.OutOfMemoryError%3A-Java-heap-space-error-tp14255237p26746374.html
Sent from the Ant - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: Frequent java.lang.OutOfMemoryError: Java heap space error
Posted by Antoine Levy Lambert <an...@gmx.de>.
Hello Vino,
how is base.path defined in your script ?
Do you have a blurb somewhere looking like
<path id="base.path">
<fileset dir="lib">
<include name="*/*.jar"/>
</fileset>
</path>
It looks like base.path is replaced at runtime literally with "<classpath>"
Regards,
Antoine
vinothofindia wrote:
> Hi,
>
> I have been encountering same issue.
>
> I got "java.lang.OutOfMemoryError: Java heap space" when I tried to compile
> my code with ANT.
> So, I tried setting ANT_OPTS env var, that doesn't resolve the issue
> permanently and the issue occurred intermittently.
>
> Then I tried setting fork attribute in my build.xml, which brought up a
> following exception
>
> Error running C:\jdk1.5.0_15\bin\javac.exe compiler
> at
> org.apache.tools.ant.ProjectHelper.addLocationToBuildException(ProjectHelper.java:537)
> at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:385)
> at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
> at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269)
> at org.apache.tools.ant.Task.perform(Task.java:364)
> at org.apache.tools.ant.Target.execute(Target.java:301)
> at org.apache.tools.ant.Target.performTasks(Target.java:328)
> at org.apache.tools.ant.Project.executeTarget(Project.java:1215)
> at org.apache.tools.ant.Project.executeTargets(Project.java:1063)
> at org.apache.tools.ant.Main.runBuild(Main.java:632)
> at org.apache.tools.ant.Main.startAnt(Main.java:183)
> at org.apache.tools.ant.launch.Launcher.run(Launcher.java:197)
> at org.apache.tools.ant.launch.Launcher.main(Launcher.java:56)
> Caused by: java.io.IOException: CreateProcess: C:\jdk1.5.0_15\bin\javac.exe
> -J-Xms256m -J-Xmx256m -d C:\target\classes -classpath <classpath>
> at java.lang.ProcessImpl.create(Native Method)
> at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
> at java.lang.ProcessImpl.start(ProcessImpl.java:30)
> at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
> at java.lang.Runtime.exec(Runtime.java:591)
> at sun.reflect.GeneratedMethodAccessor47.invoke(Unknown Source)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at
> org.apache.tools.ant.taskdefs.Execute$Java13CommandLauncher.exec(Execute.java:808)
> at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:445)
> at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:459)
> at
> org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter.executeExternalCompile(DefaultCompilerAdapter.java:449)
> ... 33 more
>
>
> The javac tag I used in my build.xml is:
> <javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
> fork="yes"
> memoryInitialSize="256m"
> memoryMaximumSize="256m"
> executable="${env.JAVA_HOME}/bin/javac"
> source="${compiler.opts.vm.source}"
> target="${compiler.opts.vm.target}"
> includes="${projectDir}/xxx/**"
> excludes="${projectDir}/xxxTest/**" >
> <classpath refid="base.path" />
>
> </javac>
>
>
> I have even tried with following javac tag in build.xml:
> <javac srcdir="${src}" destdir="${classDst}" debug="${debug}"
> fork="yes"
> memoryInitialSize="512m"
> memoryMaximumSize="512m"
> executable="${env.JAVA_HOME}/bin/javac"
> deprecation="off"
> optimize="off"
> verbose="no"
> source="${compiler.opts.vm.source}"
> target="${compiler.opts.vm.target}"
> includes="${projectDir}/xxx/**"
> excludes="${projectDir}/xxx/Test/**" >
> <classpath refid="base.path" />
> </javac>
>
>
>
> Please help me to get rid of this issue, I have been struggling with this
> issue for the last 5 days.
>
>
> Thanks in advance,
> _Vino
>
>
>
> kermitt wrote:
>
>> have you tried to fork and specify the memoryInitialSize and
>> memoryMaximumSize?
>>
>> you should try with another compiler if you were using Sun Javac, try
>> jikes or even better eclipse compiler
>> (org.eclipse.jdt.core.JDTCompilerAdapter)
>>
>> my 2cts...
>>
>>
>>
>> -----Original Message-----
>> From: Ravi Roy [mailto:ravi.aroy@gmail.com]
>> Sent: Monday, December 10, 2007 4:37 PM
>> To: user@ant.apache.org
>> Subject: Frequent java.lang.OutOfMemoryError: Java heap space error
>>
>> Hello all,
>>
>> I am running my product build with cruisecontrol using ant 1.7.0. I have
>> set
>> ANT_OPTS=-Xms=1536m -Xmx1536m, but still I am getting below mentioned
>> error,
>> I have searched mail archive, but I see ANT_OPTS settings, which I have
>> already set, I get the following error :
>>
>> [javac] The system is out of resources.
>> [javac] java.lang.OutOfMemoryError: Java heap space
>>
>> Am I doing right to set ANT_OPTS variable to increase the heap size ? I am
>> running my build machine using Windows XP with 2.0 Gigabyte of physical
>> RAM.
>>
>> Does somebody know how to handle this ? It is more frequent now.
>>
>> Thanks in adavnace for thoughts.
>>
>> Regards,
>> Ravi
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org