Question

Say suppose I am running a java program through command line. And this program requires some data to enter during the execution. So I was wondering on what happens if somebody uses javaw to run this type of program?

That is how to enter the data to the program?

Was it helpful?

Solution

You can't get interactive input, but if you wanted to read from a file, you could, or you could redirect standard input to a file or pipe.

cat myText.txt | javaw myJavaClass

or Windows

type myText.txt | javaw myjavaClass

OTHER TIPS

You can't. Since javaw doesn't allocate a console you have no way of entering data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top