• Post Reply Bookmark Topic Watch Topic
  • New Topic

problems with in.read()

 
marilyn murphy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

When I type
java Echo abcd

I get the output:
in main
in echo
in try
java.io.IOException: The handle is invalid

Can anyone explain this to me?
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this instance, you're trying to read from standard input... i.e. in.read() will block waiting for you to type stuff in, rather than reading in "abcd"
the abcd you're passing in to the program can be accessed via args[0]
the IOexception has probably occurred because you did some kind of ctrl-c or something
 
marilyn murphy
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Lewin. That was part of my problem. The other part was that I was trying to run the program from an editor rather than from the DOS prompt.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!