Writing a Control file to give inputs to a Java application
Joined: Dec 01, 2012
Dear Ranchers !
I need your help again. I have developed a java application with no GUI. It takes input from command line and runs a set of functions and returns output ( a .csv file ) after querying a dataset (.csv file).
My supervisor wants me to found out a way to write a sort of Control File in which we can write all the inputs and then run it.
Of course. Make a file which contains exactly what you would have typed at the command line, and then run your application with that file redirected to standard input.
So normally you would run the application like this:
or maybe something a bit more complicated than that, but let's just use that as an example. This will expect you to type the input at the command line. To provide input from a file, run the application like this:
java YourClass < control.txt
This will take the output from the "control.txt" file in the current working directory instead of expecting command-line input from you.
By the way this is a standard feature of the command line no matter whether it's the Windows command line or a *nix shell. It's nothing to do with Java, it works for all applications which read from standard input.