eldoctoro eldoctoro - 3 months ago 10
Java Question

Problem running .bat file on Windows due to "input line is too long"

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" %*

Answer

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.