File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes IOException error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "IOException error" Watch "IOException error" New topic

IOException error

Anton Lindroth

Joined: Feb 13, 2014
Posts: 2
Hi, I am trying to make a small server and client program in java. I have this code:


And the client code:

Both is giving me a error like:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at Client.main(
sorry for my bad english and that I programming in Swedish
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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.
I agree. Here's the link:
subject: IOException error
It's not a secret anymore!