0

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

Nate
  • 16,748
  • 5
  • 45
  • 59
Amit Battan
  • 2,968
  • 2
  • 32
  • 68

2 Answers2

4

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.

darioo
  • 46,442
  • 10
  • 75
  • 103
0

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.

Mohamed Saligh
  • 12,029
  • 19
  • 65
  • 84