This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't write an input to stdin in a Java program via command line, although I can do it on eclipse  RSS feed

 
Rafael Rodrigez
Greenhorn
Posts: 7
2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote a Server-Client model program in java, and it works great on eclipse. However, when I try to run the client via command line (in Windows 10), I can't write anything to stdin (while I can do it on Eclipse). Why is that?                       
Here is the client code (not the best one, I know):                          


                                  

When I try to run MyEchoClient with the command (after connecting to a server on port 4000)                              
I get:

                       
                             
(MyEchoClient is at folder named client).                                                         
And as I said, I can't write anything to stdin...
 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried writing a simple program to get input from the command line to see if that works.
If it does then I suggest you add some print statements to your code, especially in and around the while loop to see if your code is blocking somewhere.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!