Solved

ANT java.io.IOException: CreateProcess

Posted on 2004-10-19
28
9,097 Views
Last Modified: 2012-08-14
My ANT script is building a long classpath, and I suspect this is causing a problem.  Here is a portion of my ANT output:

BUILD FAILED
C:\RetailDirect\build.xml:103: java.io.IOException: CreateProcess: C:\j2sdk1.4.1_02\jre\bin\java.exe -classpath C:\j2sdk1.4.1_02\jre\lib\ext\dnsns.jar;...[LONG PATH]...;C:\j2sdk1.4.1_02\jre?

The ? character marks the 1010th character of the command.  Is there a 1K limit on the length of a classpath specified from the javac.exe command-line?  Or is there a limit on command-lines in general?
0
Comment
Question by:knightEknight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 10
  • +3
28 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 70 total points
ID: 12350936
In some cases, there can be a limit. Any jars in that ext directory don't need to be in the classpath
0
 
LVL 8

Assisted Solution

by:kiranhk
kiranhk earned 55 total points
ID: 12350996
usually on windows this problem occurs when the length is more but not on unix. probably u can try taking out the things not required by ur build script
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351466
Thanks for your feedback.  I have already removed all the jars I can ... next I will begin putting them in C:\X to shorten the path.  But I would not really consider this a good solution -- there may not be one.  I'll leave the question open for a while in case there are other ideas.
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 86

Expert Comment

by:CEHJ
ID: 12351496
Please post the bit of build.xml that contains the classpath
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351565
The build.xml file was generated by JBuilderX.  The portion that was failing was making a call to a JSP compiler via the command-line version of java.exe, specifying the long classpath.  When I realized this I just removed the jsp target and the build succeeded.  I'll leave the jsp compiling to the app server.


Here is a portion of the path specifier:

  <path id="project.class.path">
    <pathelement location="${dest}"/>
    <pathelement location="${Tomcat.home}/lib/common/servlet.jar"/>
    <!-- removed proprietary jars -->
    <pathelement location="${jdk.home}/jre/lib/ext/dnsns.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/ldapsec.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/localedata.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/sunjce_provider.jar"/>
    <pathelement location="${jdk.home}/jre/lib/charsets.jar"/>
    <pathelement location="${jdk.home}/jre/lib/im/indicim.jar"/>
    <pathelement location="${jdk.home}/jre/lib/jaws.jar"/>
    <pathelement location="${jdk.home}/jre/lib/jce.jar"/>
    <pathelement location="${jdk.home}/jre/lib/jsse.jar"/>
    <pathelement location="${jdk.home}/jre/lib/rt.jar"/>
    <pathelement location="${jdk.home}/jre/lib/sunrsasign.jar"/>
    <pathelement location="${jdk.home}/lib/dt.jar"/>
    <pathelement location="${jdk.home}/lib/htmlconverter.jar"/>
    <pathelement location="${jdk.home}/lib/tools.jar"/>
    <pathelement location="${jdk.home}/rt"/>
  </path>

  <path id="jspc.class.path">
    <pathelement location="${Tomcat.home}/lib/container/jasper.jar"/>
    <pathelement location="${Tomcat.home}/lib/container/crimson.jar"/>
    <pathelement location="${Tomcat.home}/lib/common/servlet.jar"/>
  </path>

   ...

   <!-- below is line 103 -->
    <jspc destdir="${compiled.jsp}/rd" srcdir="C:/Jakarta/webapps/scrubbed">
      <classpath refid="project.class.path"/>
      <classpath refid="jspc.class.path"/>
      <include name="**/*.jsp"/>
    </jspc>

0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12351607
So problem solved now then?
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351619
no, I did that before I posted the question ... I'd still like to know how to get around the command-line length limit -- if there is a way.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12351655
You could probably remove those pathelements from where that comment starts to the end. Try commenting them out
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351686
yes, I did that too but added them back in later because even when I remove them, all the JSP filenames were being passed one at a time on the command line -- so I had no hope of getting the length under 1K.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12351724
What OS are you using btw?
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351730
W2K
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351737
also tried this:

command.com /e:30000
ant
exit

still same result
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12351803
It would be cmd.exe in Win2k
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12351826
yes, but command.com is the only shell that allows you to set the environment space.

In other words, you can't do this:  cmd.exe /e:30000

besides, I doubt the environment space has much to do with the 1K limit of a command-line argument.
0
 
LVL 13

Assisted Solution

by:Webstorm
Webstorm earned 55 total points
ID: 12352189
Hi knightEknight,

When you have multiple jar files in the same directory, you can use the '*' character like :
C:\common\directory\path\*.jar
0
 
LVL 7

Accepted Solution

by:
JugglerW earned 70 total points
ID: 12352200
See here for some discussion of command line length limit:

http://weblogs.asp.net/oldnewthing/archive/2003/12/10/56028.aspx

A kind of unusual solution for your problem could be:

- Extract all the jars in your classpath to a single directory
- jar the complete directory to one big jar file: mybigfat.jar
- use this in your classpath

You may also define an ant task to do this automatically for you if any of your source jars change. But from your example above I assume the jars will change very seldom so this could easily done manually.
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12357601
Webstorm,
I wish it were so ... but ANT does not expand the wildcard characters that way.
Here is what I tried to test this in my build.xml file:

    <!--  
    <pathelement location="${jdk.home}/jre/lib/ext/dnsns.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/ldapsec.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/localedata.jar"/>
    <pathelement location="${jdk.home}/jre/lib/ext/sunjce_provider.jar"/>
     -->
    <pathelement location="${jdk.home}/jre/lib/ext/*.jar"/>

But none of the jars were included by the *.jar.


Juggler,
Thanks for the link -- I'll read thru it.  However, I'm trying to avoid all solutions that involve extracting, renaming, or moving the libraries.  I'm really just after two things:  1) Why is the command (apparently) limited to about 1K, and 2) is there a way to increase this length explicitely.

Thanks all
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12357663
1) I think there is some doubt as to the real length, but some seem to think it's 32K
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12357684
according to the link posted by Juggler above, the CreateProcess limit is 32K, the CMD.EXE limit is 8K, and the spawnv() limit is 1K.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12357706
btw are you running ant from the command line or through JBuilder now?
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12357713
command line
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12357781
Might be good to post your build.xml, or even better, a link to it. How many jsps btw?
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12357855
almost 700 JSPs.  The build.xml was generated by JBuilder and is very lengthy.  But there is nothing atypical about it that I can see.

But this issue has also appeared in other contexts:

http://forums.bea.com/bea/thread.jspa?threadID=200060432&start=-1&f#202428357

http://www.myeclipseide.com/index.php?name=PNphpBB2&file=viewtopic&p=22486#22486
0
 
LVL 33

Author Comment

by:knightEknight
ID: 12361606
I have confirmed that my command processor (CMD.EXE) allows commands to a maximum of 2K.  I have also confirmed that java.exe allows a classpath approaching that limit.  So I must conclude that something in the ANT tool is truncating the classpath at 1K.  In any event, the 2K limit imposed by CMD.EXE is far short of what I would need it to be to compile the JSPs in this fashion.  Since that limitation is not going to be solved in ANT or java.exe, I will close this question.  Thanks to all of you who contributed.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 12380065
8-)

There's probably a kludge that could be done for incremental compilation in a batch file
0
 
LVL 4

Expert Comment

by:schubach
ID: 16768472
I found that adding %JAVA_HOME%/bin to my %PATH% environment variable allowed my ant script to succeed, whereas I had been getting the same error in the same situation described in this question.  I'm not 100% sure why this fixed things, but it was a suggestion from a co-worker and I wanted to share it with others who might have the same problem, because it seems to be a very elegant solution.
0
 
LVL 33

Author Comment

by:knightEknight
ID: 16768554
Thanks!  This problem is ancient history to me now but I'll give it a try should it happen again.  :)
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate example using maven 12 108
maven module vs maven project 3 114
Netbeans and org.apache.commons.lang3 issue 3 53
Java array sort 10 62
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question