I have jar called thing.jar
It continuously receives output from the console
So when I run
java -jar thing.jar
and then start typing away at the keyboard, everything I type is received by the scanner in thing.jar
Now I have a little class file, FakeInput, such that when I run
java FakeInput
It just creates a whole lotta random output, printing it onto the console (with a 10 millisecond delay between each print) until I press ctrl-c and tell it to stop.
I want to pipe the OUTPUT from FakeInput into the INPUT of thing.jar
So why doesn’t these lines work?
java FakeInput | java -jar thing.jar
java -jar thing.jar < java FakeInput
Some weird errors happen instead, the gui window for thing.jar freezes, but shouldn’t there be a way to run them at the same time?
How can I do what I want?
Thank you.
EDIT: I SOLVED THE PROBLEM. For anyone reading the thread in the future,
java FakeInput | java -jar thing.jar
Totally works. The only problem is that a 10 millisecond delay was much to short. I changed it to 100 milliseconds and it works.
Thanks.