GeeCON Prague 2014*
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
Author

IOException error

Anton Lindroth
Greenhorn

Joined: Feb 13, 2014
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

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: http://aspose.com/file-tools
 
subject: IOException error