This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IOException error

 
Anton Lindroth
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to make a small server and client program in java. I have this code:

Server:


And the client code:


Both is giving me a error like:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Client.main(Client.java:9)
sorry for my bad english and that I programming in Swedish
 
Paul Clapham
Sheriff
Posts: 21107
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your code, "args[0]" means the first element in the "args" array. And the "args" array, because it is the parameter of your "main" method, is the array of parameters which you typed at the command line after the class name.

So the error message says that you didn't type any parameters at the command line. Try again, this time including the parameter.
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic