• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

command line parameter limit

 
Greenhorn
Posts: 19
Netbeans IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can any one tell

what is limitation for command line parameter??

Thanks in advance
 
Ranch Hand
Posts: 176
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Netbeans IDE Oracle Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic