Results 1 to 2 of 2
- 11-20-2009, 07:08 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 1
- Rep Power
- 0
Runtime error "Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
Hi All,
I am new to Java, I have written a program where i am getting the error
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
here is the code.
import java.net.URL;
import java.io.*;
import org.w3c.tidy.Tidy;
public class TestHTML2XML {
private String url;
private String outFileName;
private String errOutFileName;
public TestHTML2XML(String url, String outFileName, String
errOutFileName) {
this.url = url;
this.outFileName = outFileName;
this.errOutFileName = errOutFileName;
}
public void convert() {
URL u;
BufferedInputStream in;
FileOutputStream out;
Tidy tidy = new Tidy();
//Tell Tidy to convert HTML to XML
tidy.setXmlOut(true);
try {
//Set file for error messages
tidy.setErrout(new PrintWriter(new FileWriter(errOutFileName), true));
u = new URL(url);
//Create input and output streams
in = new BufferedInputStream(u.openStream());
out = new FileOutputStream(outFileName);
//Convert files
tidy.parse(in, out);
//Clean up
in.close();
out.close();
} catch (IOException e) {
System.out.println(this.toString() + e.toString());
}
}
public static void main(String[] args) {
/*
* Parameters are:
* URL of HTML file
* Filename of output file
* Filename of error file
*/
System.out.println("url" + args[0]);
System.out.println("abc.xml" + args[1]);
System.out.println("123.xml" + args[2]);
TestHTML2XML t = new TestHTML2XML(args[0], args[1], args[2]);
t.convert();
}
}
Please help me out where i am doing wrong.
thanks in advance.
- 11-20-2009, 07:58 PM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,400
- Blog Entries
- 7
- Rep Power
- 17
Similar Threads
-
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
By paul in forum New To JavaReplies: 8Last Post: 03-05-2011, 03:53 AM -
Exception in thread "main" java.lang.NullPointerException at LinkedList.main(Link
By kavitha_0821 in forum New To JavaReplies: 6Last Post: 07-16-2009, 03:30 PM -
Exception in thread "main" java.lang.NullPointerException at LinkedList.main(Link
By kavitha_0821 in forum New To JavaReplies: 1Last Post: 07-16-2009, 10:35 AM -
ERROR: Exception in thread "main" java.lang.NoSuchMethodError: main
By barney in forum New To JavaReplies: 1Last Post: 08-07-2007, 07:10 AM -
Error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
By romina in forum New To JavaReplies: 1Last Post: 07-25-2007, 10:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks