Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

unixperience

macrumors regular
Original poster
Jul 21, 2010
235
5
Hello I wrote a java program that prompts for user input (through terminal, nothing sophisticated)

I wanted to run the program but instead of typing the input, I wanted to use a txt file. I'm sure there is a way to do this but cant find it, anyone know how to do it

heres an example the program ask for a list of 20 numbers, so I saved a list of numbers in a text file (same dir as program) and want it to read from the file. it's just to speed up testing, I'm not looking to actually open the text file using my code or anything, i just want it to use the text file as though I were actually typing it in terminal
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.