The input line is too long - Windows command line error

There was no solution other than shorting the command.

Today I wanted to run the bat file to run a java program in Windows. This file is mainly used to set the classpath, part of the file content is shown below.
Complete file content is shows at the end.
@echo off
setlocal

set BROKER_HOME=C:/Documents and Settings/user/workspace/myProject

set CP=%BROKER_HOME%/out/lib/activation-1.0.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/activeio-2.1.jar;%CP%
...
set CP=./;%CP%
set CP="%CP%"
ECHO Using Classpath:
ECHO %CP%
cd ..
java -classpath %CP% com.mycompany.myproject.Client

An error message resulted saying "Input line is too long" as shown in the image above. This is not an error in the java program which you would guess first.

Reason for the error message

I have set up a variable for classpath which makes my command too lengthy. This message pops up since the command is too long for the Windows® command line environment to handle.
The number of characters that can be entered into a single command is limited to 8191. (this is including spaces).

For example, total number of characters in below command is 42.
javac -classpath myclasses.jar Client.java

Solution

There was no solution to the issue other than somehow making the classpath shorter by moving the jar files into a folder like "C:/jars" from initial folder at "C:/Documents and Settings/user/workspace/myProject/out/lib".

Do you have any other solutions for this issue?
[post_ads]

Complete bat file content

Below is the content of the file for your references.
@echo off
setlocal

set BROKER_HOME=C:/Documents and Settings/user/workspace/myProject

set CP=%BROKER_HOME%/out/lib/activation-1.0.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/activeio-2.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/axis.jar;%CP%
set CP=%BROKER_HOME%/out/lib/axis.ns.jar;%CP%
set CP=%BROKER_HOME%/out/lib/axis.org.jar;%CP%
set CP=%BROKER_HOME%/out/lib/axis-ant.jar;%CP%
set CP=%BROKER_HOME%/out/lib/connector.jar;%CP%
set CP=%BROKER_HOME%/out/lib/csv.jar;%CP%
set CP=%BROKER_HOME%/out/lib/csvman.jar;%CP%
set CP=%BROKER_HOME%/out/lib/jakarta-oro-2.0.8.jar;%CP%
set CP=%BROKER_HOME%/out/lib/jaxrpc.jar;%CP%
set CP=%BROKER_HOME%/out/lib/jmxri-1.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/jmxtools-1.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/log4j-1.2.8.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mail.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/backport-util-concurrent-3.0.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-beanutils-1.7.0.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-codec-1.3.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-collections-3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-digester-1.7.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-discovery-0.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-httpclient-3.0.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-jxpath-1.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-logging-1.0.4.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-net-1.4.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/commons-pool-1.3.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/dom4j-1.4.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/jug-2.0.0-asl.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-core-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-acegi-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-builders-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-client-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-management-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-ognl-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-pgp-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-scripting-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-spring-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-module-xml-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-ejb-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-email-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-file-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-ftp-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-http-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-jbi-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-jdbc-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-jms-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-multicast-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-quartz-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-rmi-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-soap-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-ssl-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-stream-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-tcp-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-udp-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-vm-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-xfire-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mule-transport-xmpp-1.3.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mx4j-impl-2.1.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mx4j-jmx-2.1.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mx4j-remote-2.1.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/mx4j-tools-2.1.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/ognl-2.6.9.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/xpp3_min-1.1.3.4.O.jar;%CP%
set CP=%BROKER_HOME%/out/lib/mule/xstream-1.2.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/commons-attributes-api-2.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/commons-dbutils-1.0.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/commons-io-1.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/commons-lang-2.2.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/geronimo-j2ee-connector_1.5_spec-1.0.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/muleOpt/geronimo-jta_1.0.1B_spec-1.0.1.jar;%CP%
set CP=%BROKER_HOME%/out/lib/netsuite-2.0.0.jar;%CP%
set CP=%BROKER_HOME%/out/lib/ojdbc14.jar;%CP%
set CP=%BROKER_HOME%/out/lib/quartz-1.4.0.jar;%CP%
set CP=%BROKER_HOME%/out/lib/saaj.jar;%CP%
set CP=%BROKER_HOME%/out/lib/spring-beans.jar;%CP%
set CP=%BROKER_HOME%/out/lib/spring-context.jar;%CP%
set CP=%BROKER_HOME%/out/lib/spring-core.jar;%CP%
set CP=%BROKER_HOME%/out/lib/wsdl4j-1.5.1.jar;%CP%
set CP=%BROKER_HOME%/out/conf;%CP%
set CP=%BROKER_HOME%/lib/commons-dbutils-1.0.jar;%CP%
set CP=./;%CP%
set CP="%CP%"

ECHO Using Classpath:
ECHO %CP%

cd ..

java -classpath %CP% com.mycompany.myproject.Client

COMMENTS

BLOGGER: 6
Loading...

Read More...

Name

About,2,Adsense,3,Ant,1,Apache,3,Axis,3,Blogger,1,Books,1,CentOS,2,Chrome,2,CSS,2,Database,3,Earn Online,3,Eclipse,10,Facebook,1,Firefox,10,Gmail,4,GNU/Linux,9,Google,26,GWT,8,Hardware,2,IE,5,Interesting,15,Internet,14,Java,49,Javascript,7,JBoss,1,Jenkins,1,Log4j,2,Me,6,Microsoft,2,Miscellaneous,1,News,11,Opinion,10,OSGi,1,PHP,1,Productivity,3,Programming,36,Puzzle,3,Security,4,Software,41,Sports,9,Spring,2,Story,6,Subversion,3,TDD,4,Tech,2,Tips,1,Tomcat,6,Tutorial,13,Ubuntu,4,Web application,14,Web Design,2,Web services,3,Windows,10,Yahoo,1,Zip,2,
ltr
item
Digizol: The input line is too long - Windows command line error
The input line is too long - Windows command line error
There was no solution other than shorting the command.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIJjGZLYY8FQsni4s0zDiJsAgGUgR4r-qiWVaJ_Awsuq5THoA327FLfF5X-luAFsVzmWxaQ-EfMPXoR5rZwU72-YxHHu_eB6oELwf4Jfm6X4fbH4XYYm310ynEKGTZU0knJHVDWg/s1600/The+Input+line+is+too+long.bmp
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIJjGZLYY8FQsni4s0zDiJsAgGUgR4r-qiWVaJ_Awsuq5THoA327FLfF5X-luAFsVzmWxaQ-EfMPXoR5rZwU72-YxHHu_eB6oELwf4Jfm6X4fbH4XYYm310ynEKGTZU0knJHVDWg/s72-c/The+Input+line+is+too+long.bmp
Digizol
https://www.digizol.com/2006/12/input-line-is-too-long-windows-command.html
https://www.digizol.com/
https://www.digizol.com/
https://www.digizol.com/2006/12/input-line-is-too-long-windows-command.html
true
7440473
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy