Bug 40852 - JavaDoc cannot handle very large classpath on windows
Summary: JavaDoc cannot handle very large classpath on windows
Alias: None
Product: Ant
Classification: Unclassified
Component: Core tasks (show other bugs)
Version: 1.6.5
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: 1.7.0
Assignee: Ant Notifications List
Keywords: PatchAvailable
Depends on: 26739
  Show dependency tree
Reported: 2006-10-31 08:24 UTC by Daniel Ribagnac
Modified: 2008-02-22 12:18 UTC (History)
0 users

patch containing mods to javadoc (2.64 KB, patch)
2006-10-31 09:27 UTC, Peter Reilly
Details | Diff
patch for Ant 165 (3.87 KB, patch)
2006-11-01 06:56 UTC, Daniel Ribagnac
Details | Diff
new quoting (3.93 KB, patch)
2006-11-01 11:09 UTC, Peter Reilly
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Ribagnac 2006-10-31 08:24:57 UTC
I had an exception (Javadoc failed: java.io.IOException: CreateProcess) when 
I run my Doclet task on Windows XP. The fact is : my classpath is very long and 
Windows' shell can not handle it.
   The 'useExternalFile' flag is set to true but it does not affect the 
classpath's variable.
   So I modify javadoc.java with the following code, is it possible to include 
it within a new release of Ant ?

        File tmpList = null;
        File optionsTmpList = null;
        PrintWriter srcListWriter = null;
        PrintWriter optionsListWriter = null;
        try {

             * Write sourcefiles and package names to a temporary file
             * if requested.
            // Code added
            // Write all options to a file             
            if (useExternalFile) {
                if (optionsTmpList == null) {
                	optionsTmpList = fileUtils.createTempFile
("javadocOptions", "", null);
                	String[] listOpt = toExecute.getArguments();
                        .setValue("@" + optionsTmpList.getAbsolutePath());
                    optionsListWriter = new PrintWriter(
                            new FileWriter(optionsTmpList.getAbsolutePath(),
                    for (int i = 0; i < listOpt.length; i++) {
						String string = listOpt[i];
						if (string.startsWith("-J-")) {
						} else  {
							if (string.startsWith("-
")) {
							} else {
(" ");
                // End of added code
                if (tmpList == null) {
                    tmpList = fileUtils.createTempFile("javadoc", "", null);
                        .setValue("@" + tmpList.getAbsolutePath());


        } finally {
            if (srcListWriter != null) {
            // Added code
            if (optionsListWriter != null) {
Comment 1 Peter Reilly 2006-10-31 09:25:01 UTC
Just a couple of problems.
1) the optionsListWriter is not closed/flushed, so the file
   is not completed
2) the code does not handle spaces in directory names
3) if the paths have \ and they are in quoted strings, javadoc does not
   like them
4) the patch should be provided as a diff agaist the
   current svn version of ant (using svn diff command)
5) the manual doc for javadoc would need to updated to describe
   new behaviour of useExternalFile

However, I think that this is a good idea,
I do not know if it can get into Ant 1.7.0.

Comment 2 Peter Reilly 2006-10-31 09:27:40 UTC
Created attachment 19060 [details]
patch containing mods to javadoc

This patch should take care of the problems
described in #2, except for the update to
the manual
Comment 3 Peter Reilly 2006-10-31 09:34:30 UTC
There is already a request for this:
Some code needs to be added to support jdk 1.3.
Comment 4 Daniel Ribagnac 2006-11-01 06:56:05 UTC
Created attachment 19064 [details]
patch for Ant 165

I used CVS diff (diff -u -p) as I do not own svn at the office.
The patch is against the source code given with Ant 165 distrib. Seems to be
revision 278386

I add your code that test directory names.
And finally this improvment is active only for JDK1.4+, even if JDK1.3 seems to
work correctly with it
Comment 5 Peter Reilly 2006-11-01 11:09:36 UTC
Created attachment 19067 [details]
new quoting

New patch, change the quoting to handle
stuff like:
<bottom><![CDATA[<i>Copyright &#169; 2000 "Dummy Corp".
also incoperate javadoc4 test and handle exceptions
when writing the options file.
Comment 6 Peter Reilly 2006-11-01 15:19:50 UTC
commited the change, should be in ant 1.7.0.