Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do you parse commandline arguments to a Java program?

commandline Java parse program
0
Posted

How do you parse commandline arguments to a Java program?

0

Ans : Perhaps surprisingly, commandline arguments are not encouraged, as they make a program not 100% pure Java. The reason is that some systems like MacOS don’t normally have a command line or command-line arguments. Consider using properties instead so that your programs fit more naturally into the environment. If you must use command-line arguments, have them comply with the POSIX conventions, i.e. they should • use a “-” instead of a “/” • be case sensitive, and • be concatenatable (-pst == -p-s-t). See http://java.sun.com/docs/books/tutorial/essential/attributes/_posix.html If such arguments are used, it should NOT be up to the invocating application (ie java.exe) to propperly parse them. According to the getopts routine from gnu, getopts is required to know exactly what the usable parameters are before it can properly parse them and create argc/argv. Because of that, it becomes unduly hard for calling programs such as java.exe to properly parse class arguments by themselves. Inst

0

[*] Perhaps surprisingly, commandline arguments are not encouraged, as they make a program not 100% pure Java. The reason is that some systems like MacOS don’t normally have a command line or command-line arguments. Consider using properties instead so that your programs fit more naturally into the environment. If you must use command-line arguments, have them comply with the POSIX conventions, i.e. they should o use a “-” instead of a “/” o be case sensitive, and o be concatenatable (-pst == -p-s-t). See http://java.sun.com/docs/books/tutorial/essential/attributes/_posix.html If such arguments are used, it should NOT be up to the invocating application (ie java.exe) to propperly parse them. According to the getopts routine from gnu, getopts is required to know exactly what the usable parameters are before it can properly parse them and create argc/argv. Because of that, it becomes unduly hard for calling programs such as java.exe to properly parse class arguments by themselves. Instea

Related Questions

Thanksgiving questions

*Sadly, we had to bring back ads too. Hopefully more targeted.