• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Writing a Control file to give inputs to a Java application

 
Jujhar Khurana
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Is there a way to do it ?
 
Paul Clapham
Sheriff
Pie
Posts: 20735
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

java YourClass


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.
 
Jujhar Khurana
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank You Paul. I appreciate.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic