Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile 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
Pie
Posts: 20750
30
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic