views:

902

answers:

10

Hi,

I'm using Windows and have a batch file (contents attached below) where I'm building up a classpath before trying to run a Java class. Unfortunately the classpath is fairly big and the file ends up being ~14kb. When I run it I'm getting an 'input line too long' error. I have read elsewhere that the max. size for an env variable is 8kb, but it looks unlikely that I'll be able to reduce the size of my classpath to fit that. Is there anything else I can do to get this to run?

thanks, Nick


echo off
subst z: C:\Users\ned24\.m2\repository
set CLASSPATH=c:\workspace-eclipse\lensfield-pom\lensfield-build\target\classes;%CLASSPATH%
set CLASSPATH=z:\wwmm\atom-archiver\0.1\atom-archiver-0.1.jar;%CLASSPATH%
set CLASSPATH=z:\commons-lang\commons-lang\2.4\commons-lang-2.4.jar;%CLASSPATH%
set CLASSPATH=z:\commons-io\commons-io\1.4\commons-io-1.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\freemarker\freemarker\2.3.9\freemarker-2.3.9.jar;%CLASSPATH%
set CLASSPATH=z:\log4j\log4j\1.2.13\log4j-1.2.13.jar;%CLASSPATH%
set CLASSPATH=z:\xom\xom\1.1\xom-1.1.jar;%CLASSPATH%
set CLASSPATH=z:\xerces\xmlParserAPIs\2.6.2\xmlParserAPIs-2.6.2.jar;%CLASSPATH%
set CLASSPATH=z:\xerces\xercesImpl\2.6.2\xercesImpl-2.6.2.jar;%CLASSPATH%
set CLASSPATH=z:\xalan\xalan\2.7.0\xalan-2.7.0.jar;%CLASSPATH%
set CLASSPATH=z:\xml-apis\xml-apis\1.0.b2\xml-apis-1.0.b2.jar;%CLASSPATH%
set CLASSPATH=z:\jaxen\jaxen\1.1-beta-8\jaxen-1.1-beta-8.jar;%CLASSPATH%
set CLASSPATH=z:\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;%CLASSPATH%
set CLASSPATH=z:\jdom\jdom\1.0\jdom-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\cdk\cdk-pure\1.2.1\cdk-pure-1.2.1.jar;%CLASSPATH%
set CLASSPATH=z:\cml\cifxml\1.4-SNAPSHOT\cifxml-1.4-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\jgrapht\jgrapht\0.6.0\jgrapht-0.6.0.jar;%CLASSPATH%
set CLASSPATH=z:\cml\jumbo-converters\0.2-SNAPSHOT\jumbo-converters-0.2-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\cml\jumbo\5.5.1-SNAPSHOT\jumbo-5.5.1-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\cml\cmlxom\2.5.1-SNAPSHOT\cmlxom-2.5.1-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\junit\junit\3.8\junit-3.8.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\commons\commons-cli\2.0-SNAPSHOT\commons-cli-2.0-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\cml\jumbo-units\0.2-SNAPSHOT\jumbo-units-0.2-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\org\lensfield\lensfield-share\0.1-SNAPSHOT\lensfield-share-0.1-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-embedder\3.0-alpha-2\maven-embedder-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-core\3.0-alpha-2\maven-core-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-lifecycle\3.0-alpha-2\maven-lifecycle-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-utils\1.5.6\plexus-utils-1.5.6.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-reporting-api\3.0-alpha-2\maven-reporting-api-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\doxia\doxia-sink-api\1.0-alpha-9\doxia-sink-api-1.0-alpha-9.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-model\3.0-alpha-2\maven-model-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-compat\3.0-alpha-2\maven-compat-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-container-default\1.0-beta-3.0.5\plexus-container-default-1.0-beta-3.0.5.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-classworlds\1.3\plexus-classworlds-1.3.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\xbean\xbean-reflect\3.4\xbean-reflect-3.4.jar;%CLASSPATH%
set CLASSPATH=z:\commons-logging\commons-logging-api\1.1\commons-logging-api-1.1.jar;%CLASSPATH%
set CLASSPATH=z:\com\google\code\google-collections\google-collect\snapshot-20080530\google-collect-snapshot-20080530.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-component-annotations\1.0-beta-3.0.5\plexus-component-annotations-1.0-beta-3.0.5.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-provider-api\1.0-beta-4\wagon-provider-api-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-plugin-api\3.0-alpha-2\maven-plugin-api-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-project\3.0-alpha-2\maven-project-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-interpolation\1.1\plexus-interpolation-1.1.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\woodstox\wstx-asl\3.2.6\wstx-asl-3.2.6.jar;%CLASSPATH%
set CLASSPATH=z:\stax\stax-api\1.0\stax-api-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\org\sonatype\spice\model-builder\1.3\model-builder-1.3.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-project-builder\3.0-alpha-2\maven-project-builder-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\commons-cli\commons-cli\1.0\commons-cli-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-interactivity-api\1.0-alpha-6\plexus-interactivity-api-1.0-alpha-6.jar;%CLASSPATH%
set CLASSPATH=z:\org\sonatype\plexus\plexus-plugin-manager\1.0-alpha-1\plexus-plugin-manager-1.0-alpha-1.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-plexus\1.0.0-alpha-2\mercury-plexus-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-repo-remote-m2\1.0.0-alpha-2\mercury-repo-remote-m2-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-repo-api\1.0.0-alpha-2\mercury-repo-api-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-artifact\1.0.0-alpha-2\mercury-artifact-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\codehaus\plexus\plexus-lang\1.1\plexus-lang-1.1.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-transport-api\1.0.0-alpha-2\mercury-transport-api-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-crypto-api\1.0.0-alpha-2\mercury-crypto-api-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-logging\1.0.0-alpha-2\mercury-logging-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-external\1.0.0-alpha-2\mercury-external-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-event\1.0.0-alpha-2\mercury-event-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-md-shared\1.0.0-alpha-2\mercury-md-shared-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-util\1.0.0-alpha-2\mercury-util-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-crypto-basic\1.0.0-alpha-2\mercury-crypto-basic-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\bouncycastle\bcprov-jdk15\140\bcprov-jdk15-140.jar;%CLASSPATH%
set CLASSPATH=z:\bouncycastle\bcpg-jdk15\140\bcpg-jdk15-140.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-transport-http\1.0.0-alpha-2\mercury-transport-http-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\mortbay\jetty\jetty-client\6.1.12\jetty-client-6.1.12.jar;%CLASSPATH%
set CLASSPATH=z:\org\mortbay\jetty\jetty-sslengine\6.1.12\jetty-sslengine-6.1.12.jar;%CLASSPATH%
set CLASSPATH=z:\org\mortbay\jetty\jetty\6.1.12\jetty-6.1.12.jar;%CLASSPATH%
set CLASSPATH=z:\org\mortbay\jetty\jetty-util\6.1.12\jetty-util-6.1.12.jar;%CLASSPATH%
set CLASSPATH=z:\org\mortbay\jetty\servlet-api-2.5\6.1.12\servlet-api-2.5-6.1.12.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-repo-local-m2\1.0.0-alpha-2\mercury-repo-local-m2-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-repo-virtual\1.0.0-alpha-2\mercury-repo-virtual-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-repo-cache-fs\1.0.0-alpha-2\mercury-repo-cache-fs-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\mercury\mercury-md-sat\1.0.0-alpha-2\mercury-md-sat-1.0.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\sat4j\org.sat4j.core\2.0.4\org.sat4j.core-2.0.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\sat4j\org.sat4j.pb\2.0.4\org.sat4j.pb-2.0.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\slf4j\slf4j-jdk14\1.5.3\slf4j-jdk14-1.5.3.jar;%CLASSPATH%
set CLASSPATH=z:\org\slf4j\slf4j-api\1.5.0\slf4j-api-1.5.0.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-mercury\3.0-alpha-2\maven-mercury-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\maven-toolchain\3.0-alpha-2\maven-toolchain-3.0-alpha-2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-http-lightweight\1.0-beta-4\wagon-http-lightweight-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-http-shared\1.0-beta-4\wagon-http-shared-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\nekohtml\xercesMinimal\1.9.6.2\xercesMinimal-1.9.6.2.jar;%CLASSPATH%
set CLASSPATH=z:\nekohtml\nekohtml\1.9.6.2\nekohtml-1.9.6.2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-ssh\1.0-beta-4\wagon-ssh-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\com\jcraft\jsch\0.1.38\jsch-0.1.38.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-ssh-common\1.0-beta-4\wagon-ssh-common-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-ssh-external\1.0-beta-4\wagon-ssh-external-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\maven\wagon\wagon-file\1.0-beta-4\wagon-file-1.0-beta-4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-repository-api\2.2.4\sesame-repository-api-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-query\2.2.4\sesame-query-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-model\2.2.4\sesame-model-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-collections\2.3\aduna-commons-collections-2.3.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-concurrent\2.2\aduna-commons-concurrent-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-iteration\2.3\aduna-commons-iteration-2.3.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-i18n\1.0\aduna-commons-i18n-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-rio-api\2.2.4\sesame-rio-api-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-lang\2.3\aduna-commons-lang-2.3.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-net\2.2\aduna-commons-net-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-text\2.2\aduna-commons-text-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-io\2.4\aduna-commons-io-2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryresultio-api\2.2.4\sesame-queryresultio-api-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryparser-sparql\2.2.4\sesame-queryparser-sparql-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryparser-api\2.2.4\sesame-queryparser-api-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryalgebra-model\2.2.4\sesame-queryalgebra-model-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-repository-sail\2.2.4\sesame-repository-sail-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-sail-api\2.2.4\sesame-sail-api-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-sail-nativerdf\2.2.4\sesame-sail-nativerdf-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-sail-inferencer\2.2.4\sesame-sail-inferencer-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryparser-serql\2.2.4\sesame-queryparser-serql-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryalgebra-evaluation\2.2.4\sesame-queryalgebra-evaluation-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-queryresultio-sparqlxml\2.2.4\sesame-queryresultio-sparqlxml-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\info\aduna\commons\aduna-commons-xml\2.2\aduna-commons-xml-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-rio-rdfxml\2.2.4\sesame-rio-rdfxml-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\openrdf\sesame\sesame-rio-turtle\2.2.4\sesame-rio-turtle-2.2.4.jar;%CLASSPATH%
set CLASSPATH=z:\net\sourceforge\jena\jena\2.4\jena-2.4.jar;%CLASSPATH%
set CLASSPATH=z:\antlr\antlr\2.7.5\antlr-2.7.5.jar;%CLASSPATH%
set CLASSPATH=z:\net\sourceforge\jena\arq\1.4\arq-1.4.jar;%CLASSPATH%
set CLASSPATH=z:\net\sourceforge\jena\iri\1.0\iri-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\commons-logging\commons-logging\1.1\commons-logging-1.1.jar;%CLASSPATH%
set CLASSPATH=z:\logkit\logkit\1.0.1\logkit-1.0.1.jar;%CLASSPATH%
set CLASSPATH=z:\avalon-framework\avalon-framework\4.1.3\avalon-framework-4.1.3.jar;%CLASSPATH%
set CLASSPATH=z:\javax\servlet\servlet-api\2.3\servlet-api-2.3.jar;%CLASSPATH%
set CLASSPATH=z:\concurrent\concurrent\1.3.4\concurrent-1.3.4.jar;%CLASSPATH%
set CLASSPATH=z:\icu4j\icu4j\3.4\icu4j-3.4.jar;%CLASSPATH%
set CLASSPATH=z:\org\json\json\1.0\json-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\woodstox\wstx-asl\2.8\wstx-asl-2.8.jar;%CLASSPATH%
set CLASSPATH=z:\owlapi\owlapi\2.2.0\owlapi-2.2.0.jar;%CLASSPATH%
set CLASSPATH=z:\org\slf4j\slf4j-log4j12\1.4.2\slf4j-log4j12-1.4.2.jar;%CLASSPATH%
set CLASSPATH=z:\org\clojure\clojure-lang\1.1.0-alpha-SNAPSHOT\clojure-lang-1.1.0-alpha-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\org\clojure\clojure-contrib\1.0-SNAPSHOT\clojure-contrib-1.0-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\wwmm\pub-crawler\0.1\pub-crawler-0.1.jar;%CLASSPATH%
set CLASSPATH=z:\commons-httpclient\commons-httpclient\3.1\commons-httpclient-3.1.jar;%CLASSPATH%
set CLASSPATH=z:\commons-codec\commons-codec\1.2\commons-codec-1.2.jar;%CLASSPATH%
set CLASSPATH=z:\org\dspace\foresite\SNAPSHOT\foresite-SNAPSHOT.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\jena\2.5.5\jena-2.5.5.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\arq\2.2\arq-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\org\apache\lucene\lucene-core\2.2.0\lucene-core-2.2.0.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\arq-extra\2.2\arq-extra-2.2.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\jenatest\2.5.5\jenatest-2.5.5.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\iri\0.5\iri-0.5.jar;%CLASSPATH%
set CLASSPATH=z:\com\ibm\icu\icu4j\3.4.4\icu4j-3.4.4.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\concurrent-jena\1.3.2\concurrent-jena-1.3.2.jar;%CLASSPATH%
set CLASSPATH=z:\com\hp\hpl\jena\json-jena\1.0\json-jena-1.0.jar;%CLASSPATH%
set CLASSPATH=z:\rome\rome\0.9\rome-0.9.jar;%CLASSPATH%
set CLASSPATH=z:\org\ccil\cowan\tagsoup\tagsoup\1.0.1\tagsoup-1.0.1.jar;%CLASSPATH%
set CLASSPATH=z:\javax\vecmath\1.2\vecmath-1.2.jar;%CLASSPATH%

java clojure.main "%LENSFIELD_HOME%\lensfield-build\src\main\clj\lensfield\cli.clj" %*
A: 

The maximum size for an environment variable is around 32760 characters. However, the maximum size for a single command line in cmd (and therefore in batch files) is 8190 characters.

Since you're building a very long CLASSPATH variable here you encounter that limitation, even though the environment variable in question can still be much longer. Delayed expansion probably won't help here since it still results in a unwieldy long command line.

Currently I see two options:

  • Use VBScript instead of a batch file. I guess1 that it supports lines longer than that. Also you are not forced to have the entire classpath written out in a single line of code; it can easily be in a string.
  • Use setx, included with Windows Vista or later, or in the Windows Resource kit before that. setx allows you to read from a file, but it also writes directly to the registry, so it's essentially equivalent to setting the classpath in your user's environment (instead of only for a single process).


1 I'm nowhere sure but it doesn't inherit the legacy codebase of cmd so it might be a reasonable assumption.

Joey
A: 

Why are you hunting for the java class path? If you know where the class is, then just call that class by the direct path name, not its file name.

Daniel A. White
A: 

Whoops just read your question again. Windows has a famous MAX_PATH length problem.

Preet Sangha
Not related to that at all.
Joey
+2  A: 

You might be able to refactor by defining more drive letters, i.e. if you had W: to point at "z:\org\apache\maven\" that ought to cut out a few characters. Repeat that a couple of times, and you might get low enough for it to work.

unwind
A: 

Do any of those jars care where they live? Could you just have the batch file copy them all into a localjar directory, and then you could just list them?

You could use xcopy /d/y, which only copies if the file has changed.

lavinio
A: 

Instead of the subst command you could try to create short symbolic links to all the directories where your JARs reside. Use the free junction tool from the Windows Sysinternals Suite to achieve this.

[...]

Using Junction

Use junction to list junctions:

Usage: [-s]

-s Recurse subdirectories

Examples:

To determine if a file is a junction, specify the file name:

junction c:\test

To list junctions beneath a directory, include the –s switch:

junction -s c:\

To create a junction c:\Program-Files for "c:\Program Files":

C:\>md Program-Files

C:\>junction c:\Program-Files "c:\Program Files"

To delete a junction, use the –d switch:

junction -d c:\Program-Files

Frank Bollack
A: 

Another option if you are running vista and java 6 is to make a directory with symbolic links using the MKLINK command so that all the jars appear in one directory, and then use the java 6 ability to reference all of the jars with a *.jar.

I think the other answers pretty much exhaust the windows options, but another option is to make a wrapper jar that invokes the clojure.main and puts all of these jars in its classpath.

Yishai
+2  A: 

If you are using Java 6, you can use a wildcard in the classpath, for example:

java -cp libs/* com.mypackage.MyProgram

See the documentation (scroll down to "Understanding class path wildcards") for more details.

Note: This doesn't work on older versions of Java.

Jesper
This is new to me and I've been using 6 for 18 months! Good to know.
hbunny
how would you get Ant to retrieve the string "libs/*" from the <path>..</path> object ?
DavidM
+1  A: 

I'm not completely au courant on Windows specifics, but given that you're having a command line problem, and not a variable size problem, can't you define variables and use those? For example:

    
    set PLEXHOME=z:\org\codehaus\plexus\plexus-component-annotations\1.0-beta-3.0.5\plexus-component-annotations-1.0-beta-3.0.5.jar
    set CLASSPATH=%PLEXHOME%;%CLASSPATH%
    set WAGONHOME=z:\org\apache\maven\wagon\wagon-provider-api\1.0-beta-4\wagon-provider-api-1.0-beta-4.jar
    set CLASSPATH=%WAGONHOME%;%CLASSPATH%
    set MAVENAPIHOME=z:\org\apache\maven\maven-plugin-api\3.0-alpha-2\maven-plugin-api-3.0-alpha-2.jar
    set CLASSPATH=%MAVENAPIHOME%;%CLASSPATH%
    ...
CPerkins
A: 

The problem is in the first set CLASSPATH=....;%CLASSPATH% just eliminate the %CLASSPATH% at the end. The error isn't descriptive, but is because %CLASSPATH% has not value.

aledbf