Hey peeps,

I want to simply compile this program but i keep getting the error message: java.lang.ArrayIndexOutOfBoundsException

Any help? :)

import java.util.ArrayList;
import org.htmlparser.util.*;
import org.htmlparser.*;
import org.htmlparser.tags.*;
import org.htmlparser.filters.*;

public class you {
	static String s;

	static ArrayList <String> filter(String s,ArrayList <String> m)
		ArrayList <String> m1= new ArrayList<String>();

		for(int i=0;i<m.size();i++){

			String c=m.get(i);



		return m1;

	public static void main (String [] args) throws ParserException{

		Parser parser = new Parser (args[0]);
		NodeList list = parser.parse (new LinkStringFilter("")); 

		ArrayList <String>m= new ArrayList<String>();
		for (int i=0;i<list.size();i++)

		String s="http://"+args[0];


		for(String si :m){


Btw in order to compile this - u guys need to put a htmlparser.jar into ur classpath !
just in case - this code don't compile for u !

ArrayIndexOutOfBoundsException happens when you run the program, not when you compile. The message tells you which line it happens on - this is important info!
It may be line 37 where you reference args[0] (the first arg passed when your program is run) - if you supply no args then the array is empty and trying to ref its first element is an index out of bounds.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.