Say suppose I am running a java program through command line. And this program requires some data to enter during the execu开发者_运维百科tion. 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?
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
You can't. Since javaw
doesn't allocate a console you have no way of entering data.
精彩评论