run java w/txt file as terminal input

Discussion in 'Mac Programming' started by unixperience, Jan 4, 2011.

  1. unixperience macrumors regular

    Jul 21, 2010
    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
  2. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
  3. unixperience thread starter macrumors regular

    Jul 21, 2010
    thanks so much, thats exactly what I needed

Share This Page