shijie xu
shijie xu

Reputation: 2097

Console input lots of data for Java

I wrote a program that accepts whitespace delimited numbers from console. For convenience, I saved all input in a file, such as:

1 4
3 5
3 4 5
1 2
1 1 -1
3 -1 0
2 0 -1
0 1 1

Normally, I run my program as:

    java -cp .:path  test

and then type the data above one by one on the console. I am tried of this. So is there any good way to run the test, so that it can takes the content in the file as console input?

Also, is it a good way in the netbean/eclipse for debug with these data? Thanks

Upvotes: 0

Views: 69

Answers (1)

nogard
nogard

Reputation: 9706

You can redirect the standard input to read from the file, like this:

java -cp .:path test < input.txt

UPDATE:

I'm not familiar with Netbeans, but this seems to answer your question

Upvotes: 3

Related Questions