• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Writing a Control file to give inputs to a Java application

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You Paul. I appreciate.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic