This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes Java in General and the fly likes Maximum length of Command Line Argument Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Maximum length of Command Line Argument " Watch "Maximum length of Command Line Argument " New topic

Maximum length of Command Line Argument

murthy bala

Joined: Dec 20, 2005
Posts: 9
I am trying to call a java class along with a command line argument from a shell script . The line of code in the shell script will be like as follows:

From java documentation I understand that the maximum command line argument length can be up to a maximum of Integer.MAX_VALUE (approximately 2147483647).

But does this hold good when i am calling this java class from within a shell script too ? I believe that there is a maximum length applicable to command line arguments in UNIX. In any way does this value restricts the Integer.MAX_VALUE that JAVA allows?

Thanks in Advance for your help.

David Newton

Joined: Sep 29, 2008
Posts: 12617

DOS has a shorter command line limit than most (all?) Unix shells... that said, I sure wouldn't rely on being able to pass in a humongous command line. Better to have the Java code accept its input from a file (possibly in addition to the command line).
rocket mass heater kickstarter
subject: Maximum length of Command Line Argument