Amit Battan
Amit Battan

Reputation: 3018

Build fail in java

I am try to build my java application in command prompt, but it fails as..

compile-core:
    [javac] Compiling 1085 source files to c:\conet\app\build\core
    [javac]
    [javac]
    [javac] The system is out of resources.
    [javac] Consult the following stack trace for details.
    [javac] java.lang.OutOfMemoryError: Java heap space

BUILD FAILED
C:\conet\app\build.xml:324: Compile failed; see the compiler error output for details.

Total time: 1 minute 5 seconds
C:\conet\app>

Any solution for this type of problem.

Thanks

Upvotes: 0

Views: 7868

Answers (2)

Mohamed Saligh
Mohamed Saligh

Reputation: 12339

If Java runs out of memory, the following error occurs:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space This can have two reasons:

  1. Your Java application has a memory leak. There are tools like YourKit Java Profiler that help you to identify such leaks.
  2. Your Java application really needs a lot of memory (more than 128 MB by default!). In this case the Java heap size can be increased using the following runtime parameters:

    javac -Xms<initial heap size> -Xmx<maximum heap size>

Defaults are:

javac -Xms32m -Xmx128m

Please increase the memory accordingly as required.

Upvotes: 0

darioo
darioo

Reputation: 47183

Since you're using ant, you should increase the available heap size for compilation. Add this to your build.xml compilation target:

memoryinitialsize="256m"
memorymaximumsize="1024m"

Info taken from here.

Upvotes: 4

Related Questions