0

I'm using the JavaCompiler APIs to compile some Java source code. However, I'm getting OutOfMemoryError exceptions. I tried to use the -Xmx1G options, but it does not work:

java.lang.IllegalArgumentException: invalid flag: -J-Xmx1G
    at com.sun.tools.javac.api.JavacTool.processOptions(JavacTool.java:236)
    at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:207)
    at com.sun.tools.javac.api.JavacTool.getTask(JavacTool.java:53)

Has anyone successfully increased the heap size setting the correct options? I also unsuccessfully tried:

Xmx1G

-Xmx1G

J-Xmx1G

-J -Xmx1G

-J Xmx1G

user803437
  • 13
  • 2
  • It seems you are trying to do this programmatically at run-time. Why not set a memory size for the app. that invokes the compiler? – Andrew Thompson Feb 22 '13 at 17:13
  • yeah, that's what I tried after..sometimes the simplest solution is the one that really fix the problem.. – user803437 Mar 20 '13 at 21:03

0 Answers0