You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jake Pezaro <Ja...@vcint.com> on 2006/02/21 17:53:37 UTC

java compiler memory and/or forking problems

i need to do some memory-intensive java compilation (918 files, 678 in
one directory alone, largest .java file is around 500K).  setting the
-J-Xmx argument should fix it.  the problems i encountered are:

- i must fork the process in order to do it as the maven compiler will
not accept this option
- forking the process fails with the following error (possibly due to
the command line options being 82789 characters long):

Caused by: java.io.IOException: CreateProcess: CMD.EXE /X /C javac -d
c:\dev\workspace\CheltenhamWeb-2-2-1\target\classes -classpath
c:\dev\...<very long command
line>\axis-saaj-1.3.jar;C:\DOCUME~1\user\.m2\repository\axi?
        at java.lang.Win32Process.create(Native Method)
        at java.lang.Win32Process.<init>(Win32Process.java:66)
        at java.lang.Runtime.execInternal(Native Method)
        at java.lang.Runtime.exec(Runtime.java:566)
        at
org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:692)
        ... 24 more

i am not sure how to solve this.  is there a way to increase the
compiler memory without forking the process?  is there a way to fix the
problem i am having forking the javac process?  any suggestions welcome.

thanks

jake

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
______________________________________________________________________

Re: java compiler memory and/or forking problems

Posted by Yann Le Du <le...@gmail.com>.
Hi Jake,

I don't know about your fork error, I successfully forked the compiler both
on Linux and Windows. But you can pass parameters to the Maven JVM using an
env var called MAVEN_OPTS with value e.g. ' -Xms16m -Xmx64m ' (for further
options, check bin\mvn.bat).

Hope this helps,

- Yann

2006/2/21, Jake Pezaro <Ja...@vcint.com>:
>
> i need to do some memory-intensive java compilation (918 files, 678 in
> one directory alone, largest .java file is around 500K).  setting the
> -J-Xmx argument should fix it.  the problems i encountered are:
>
> - i must fork the process in order to do it as the maven compiler will
> not accept this option
> - forking the process fails with the following error (possibly due to
> the command line options being 82789 characters long):
>
> Caused by: java.io.IOException: CreateProcess: CMD.EXE /X /C javac -d
> c:\dev\workspace\CheltenhamWeb-2-2-1\target\classes -classpath
> c:\dev\...<very long command
> line>\axis-saaj-1.3.jar;C:\DOCUME~1\user\.m2\repository\axi?
>         at java.lang.Win32Process.create(Native Method)
>         at java.lang.Win32Process.<init>(Win32Process.java:66)
>         at java.lang.Runtime.execInternal(Native Method)
>         at java.lang.Runtime.exec(Runtime.java:566)
>         at
> org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:692)
>         ... 24 more
>
> i am not sure how to solve this.  is there a way to increase the
> compiler memory without forking the process?  is there a way to fix the
> problem i am having forking the javac process?  any suggestions welcome.
>
> thanks
>
> jake
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email
> ______________________________________________________________________
>

Re: java compiler memory and/or forking problems

Posted by Marc Dugger <ma...@realtybaron.com>.
Jake, I got around this problem while attempting to compile with JDK
1.3.  What I did was modify the Plexus JavaCompiler to use a file list
instead of the command line.  The challenge is creating a mojo
component.  Here's the code in case you want to do the same:  

File fileList = new File(config.getWorkingDirectory(), "sourceFiles");
        try {
            FileWriter fwriter = new FileWriter(fileList);
            for ( int i = 0; i < sourceFiles.length; i++ )
            {
                fwriter.write(sourceFiles[i] + "\n");
            }
            fwriter.flush();
            args.add("@" + fileList.getName());
        } catch (IOException e) {
            e.printStackTrace();
        }

Contact me directly if you need help doing this.  HTH. 

Marc Dugger
marc@realtybaron.com

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6% real estate sales commission? Not likely.
Learn why at http://tinyurl.com/dvkbu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Quoting Jake Pezaro <Ja...@vcint.com>:

> i need to do some memory-intensive java compilation (918 files, 678
> in
> one directory alone, largest .java file is around 500K).  setting
> the
> -J-Xmx argument should fix it.  the problems i encountered are:
> 
> - i must fork the process in order to do it as the maven compiler
> will
> not accept this option
> - forking the process fails with the following error (possibly due
> to
> the command line options being 82789 characters long):
> 
> Caused by: java.io.IOException: CreateProcess: CMD.EXE /X /C javac
> -d
> c:\dev\workspace\CheltenhamWeb-2-2-1\target\classes -classpath
> c:\dev\...<very long command
> line>\axis-saaj-1.3.jar;C:\DOCUME~1\user\.m2\repository\axi?
>         at java.lang.Win32Process.create(Native Method)
>         at java.lang.Win32Process.<init>(Win32Process.java:66)
>         at java.lang.Runtime.execInternal(Native Method)
>         at java.lang.Runtime.exec(Runtime.java:566)
>         at
> org.codehaus.plexus.util.cli.Commandline.execute(Commandline.java:692)
>         ... 24 more
> 
> i am not sure how to solve this.  is there a way to increase the
> compiler memory without forking the process?  is there a way to fix
> the
> problem i am having forking the javac process?  any suggestions
> welcome.
> 
> thanks
> 
> jake
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security
> System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org