Sorry if this is the wrong forum but I didn't find anything related to CLI.
I have a requirement where I need to parse lots of arguments (as many as 50 even) and process them. Google tells me there are numerous open source parsers available like JOpt, JArgs, ArgsParser, ApacheCommons etc. As I have never used any of these before, I am not aware of any pros and cons. Have any of the members used any similar tools? Which is the most optmized?(Speed is of the essence in my application) Any suggestions on which one I should go for?
Any inputs will be most appreciated. Thanks.
Post by:Ulf Dittmer
I would choose one this is still being developed, and where you find the API pleasant to work with; the Apache Commons one seems a good choice. Since CL parameters are only used once at startup, it would be very unusual for the parsing/handling of them to make much of a difference in terms of performance.
Post by:Maneesh Godbole
Originally posted by Ulf Dittmer: Since CL parameters are only used once at startup, it would be very unusual for the parsing/handling of them to make much of a difference in terms of performance.[/QB]
Generally speaking..yes. But in my case, my utility will be invoked using the CLI arguments everytime some specific event happens. Based on the arguments, the utility will perform some validations, create an object from them, and dispatch it to some other process running on some remote machine. Then the utility will terminate.
Since the number of arguments are large (around 50 right now) and the events can happen at unpredictable times, I want to make sure my utility is optimized.
Thanks for the input. I have downloaded Commons CLI and am trying it out.
Would you advise to run this as a daemon process or something so as to avoid the start up processes which will happen if my utility is started on every event? (as opposed to invoked while in a daemon stage)
Post by:Roseanne Zhang
, Ranch Hand
There is a standard way to parse command line options.
Don't write your own code!
Google search getOptions(), you will find many in many different languages.
Years ago, I translated one in C to Java, then later found one in Java already.
This thread has been viewed 1069 times.
All times above are in ranch (not your local) time.
The current ranch time is Sep 21, 2018 01:33:16.