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