Java Error

Here is the Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0at VirusLook.main(VirusLook.java:3)
[145 byte] By [CompilerCama] at [2007-11-26 17:49:50]
# 1
Can you post the code for VirusLook? Please use the code tags (there's a code button right next to Spell Check when you post). In the VirusLook.java file on line #3, you are trying to use an index value of zero on an array (or something like an array) when the array size is zero.
atmguya at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 2

public class VirusLook {

public static void main(String[] arguments) {

int numViruses = Integer.parseInt(arguments[ 0] );

if (numViruses > 0) {

Virus[] virii = new Virus[ numViruses];

for (int i = 0; i < numViruses; i++) {

virii[ i] = new Virus();

}

System.out.println("There are " + Virus.getVirusCount()

+ " viruses.");

}

}

}

CompilerCama at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 3

1. Please use code tags like you were told in the first reply!

2. As atmguy told you from your error message you have an array index problem on line 3. The only place you are accessing an array on that line is: "arguments[0]". Therefore arguments must be an empty array.

3. To correct either take out the code or pass an argument to the main method.

zadoka at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 4
Now that I look at your post history, you had the exactly same problem in May. And you were given the answer then: http://forum.java.sun.com/thread.jspa?threadID=733951&messageID=4219721#4219721Hope that helps.
zadoka at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 5
Now when I try to run it, Eclipse says that it is terminated.>cam
CompilerCama at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 6
Anyone?
CompilerCama at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...
# 7
May be if you post the whole, exact error message some one can interpret it. You should also post whether the error occurs when you compile or when you try to run it. For me, I don't use Eclipse so I can't even make a guess.
atmguya at 2007-7-9 5:02:20 > top of Java-index,Developer Tools,Debugging and Profiling Tool APIs...