• Post Reply Bookmark Topic Watch Topic
  • New Topic

command line parameter limit  RSS feed

 
Preethi sakar
Greenhorn
Posts: 19
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any one tell

what is limitation for command line parameter??

Thanks in advance
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For no. of parameters i'm not sure(maybe as many as we want). The elements are stored in ab array so as much as it don't run out of memory there should be no problem.
The maximum command line argument length can be up to a maximum of Integer.MAX_VALUE (approximately 2147483647).

 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shubham Semwal wrote:You can read This.

That appears to be referring to C. There is no argc parameter in Java.

As all the arguments go into an array and arrays are indexed by ints, the number of arguments is probably limited to Integer.MAX_VALUE.
I doubt if Java imposes any maximum length to the command line, but the operating system might and if it does this will vary from one OS to another.

Probably the best place to look for an answer to this is the Java Language Specification document.
 
Shubham Semwal
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:
Shubham Semwal wrote:You can read This.

That appears to be referring to C. There is no argc parameter in Java.

Probably the best place to look for an answer to this is the Java Language Specification document.


I checked on java also. It's the maximum limit.
The general theory behind it should be same but just to be safe i'l remove that link
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the practical limit will be determined by how much memory a String object takes up, and by how many nanoseconds it takes to convert a parameter into a String object.
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preethi sakar wrote:
what is limitation for command line parameter??



I think the limitation is dependent on the operating system. While a string can hold a lot of data, the operating system won't have a lot to provide the application.

If memory serves, Windows is about 8K bytes for command line parameters. Linux is much better, but I still think it is in the KB range -- and not in the MB range.

Henry
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the limitation is how many characters I'd want to type on the command line...which is MUCH less than 8k...
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The limitations are in the Java VM specification (JDK7 edition), and I couldn't find anything about command‑line arguments.
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shubham Semwal wrote:The maximum command line argument length can be up to a maximum of Integer.MAX_VALUE (approximately 2147483647).


I'm not volunteering to try typing that many characters at the command line to see if this statement is true.
 
Preethi sakar
Greenhorn
Posts: 19
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Henry Wong wrote:
Preethi sakar wrote:
what is limitation for command line parameter??



I think the limitation is dependent on the operating system. While a string can hold a lot of data, the operating system won't have a lot to provide the application.

If memory serves, Windows is about 8K bytes for command line parameters. Linux is much better, but I still think it is in the KB range -- and not in the MB range.

Henry


thanks my doubt get cleared
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!