{"id":7008,"date":"2014-03-29T05:07:14","date_gmt":"2014-03-28T18:07:14","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=7008"},"modified":"2014-03-29T05:07:14","modified_gmt":"2014-03-28T18:07:14","slug":"java-command-line-arguments-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/java-command-line-arguments-primer-tutorial\/","title":{"rendered":"Java Command Line Arguments Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/CommandLineArguments\/Java_CommandLineArguments.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"Java Command Line Arguments Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/Java\/CommandLineArguments\/Java_CommandLineArguments.jpg\" title=\"Java Command Line Arguments Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Java Command Line Arguments Primer Tutorial<\/p><\/div>\n<p>If you are writing a <a target=_blank title='Batch processing information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Batch_program'>batch process<\/a> and have reached a process part requiring a compiled program (perhaps because this part has some CPU grunt associated with it) you can do a lot worse than use Java and allow user usage flexibility via that Java application&#8217;s command line argument usage logic, to write that part of the overall solution (which is, perhaps, some &#8220;brilliant-issimo&#8221; shell script &#8230; know you can do it).   Think of Command Line Arguments as a Java (or C or C++) program&#8217;s interface to the operating system.   Think of it like those brilliant Linux and Unix commands with all those switches, which do very well <a target=_blank title='Piped program information from Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Pipeline_%28software%29'>piped<\/a> off each other, as ingredients in making the <a target=_blank title=' ... it has been a while ...' href='http:\/\/www.youtube.com\/watch?v=CPMpeNDIGdk'>&#8220;cake&#8221;<\/a>.   The cake metaphor is pretty good for thinking of the whole solution made up of various parts (Visual Studio thinks of its applications as &#8220;solutions&#8221; also).<\/p>\n<p>If you want your Java program to be like a pipe program, have it use standard input and standard output.   Java and C(++) have lots of similarities in this area.   So, today, with our <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/Java\/CommandLineArguments\/Java_CommandLineArguments.jpg\" title=\"Click picture\">tutorial<\/a> we ask for some numeric input and calculate the mean, median, mode and standard deviation of that set of numbers, allowing for various modes in input user usage.<\/p>\n<p>Link to Java programming source code which you should rename to <a target=_blank title='CommandLineLogic.java' href='http:\/\/www.rjmprogramming.com.au\/Java\/CommandLineArguments\/CommandLineLogic.java_GETME'>CommandLineLogic.java<\/a><\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d7008' onclick='var dv=document.getElementById(\"d7008\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Java\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d7008' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>If you are writing a batch process and have reached a process part requiring a compiled program (perhaps because this part has some CPU grunt associated with it) you can do a lot worse than use Java and allow user &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/java-command-line-arguments-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,37],"tags":[96,135,234,235,644,707,885,946,996,997,1139,1171,1222,1319,1339],"class_list":["post-7008","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-application","tag-batch","tag-command-line","tag-command-line-arguments","tag-java","tag-linux","tag-operating-system-2","tag-pipe","tag-program","tag-programming","tag-shell-script","tag-solution","tag-supervisor","tag-tutorial","tag-unix"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7008"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=7008"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7008\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=7008"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=7008"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=7008"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}