Java run error - ArrayIndexOutOfBoundsException

Hi, I try to run code below but it show me the error :

public class JClientDemo {

public static void main (String [] args)

{

JClientDemo demo = new JClientDemo ();

demo.testClientApi (args);

}

public void testClientApi (String [] args)

{

System.out.println("Test Client API starts");

if (args[0] != null)loginRequest.setServerIp(args[0]);

if (args[1] != null) loginRequest.setServerPort (Integer.parseInt(args[1]));

if (args[2] != null)loginRequest.setLoginFile(args[2]);

System.out.println("Test Client API Finish");

}

}

Output :

Test Client API starts

java.lang.ArrayIndexOutOfBoundsException: 0

at JClientDemo.testClientApi(JClientDemo.java:53)

at JClientDemo.main(JClientDemo.java:20)

Exception in thread "main"

Any problem with this program ? Thanks.

[907 byte] By [wes68a] at [2007-11-27 5:22:51]
# 1
hi,when u run this program r u passing 3 arguments ...java <URfilename> <parameter1> <parameter2> <parameter3>as U r accessing upto 3 index ie. arr[2](zero based)So if u pass ne thing les than 3 arguments...its going to b this exception
Aniketjma at 2007-7-12 11:48:29 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...