no compiling errors but it gives a weird error when i run it.

this is the error i get when i run it.

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0

at filecopier.main(filecopier.java:8)

Here is my code it's supposed to copt text from one file to another

import java.io.*;

class filecopier{

//this program copies text from one file to another

//the file names are read as command line arguments

publicstaticvoid main(String arg[]){

String f1n=arg[0];

String f2n=arg[1];

try{

DataInput f1 =new DataInputStream(new FileInputStream(f1n));

DataOutput f2 =new DataOutputStream(new

FileOutputStream(f2n));

String x =f1.readLine();

while (x!=null){

f2.writeBytes(x+"\r\n");

x=f1.readLine();

}//end while

}catch (Exception ex){String err=ex.toString() ;

System.out.println(err);}

}

}

what is wrong with it?

[1744 byte] By [dannyd73] at [2007-9-30 22:10:33]
# 1
Lots of things, but we'll stick with the exception you got.I'm betting that you ran it without giving any command line arguments.%
duffymo at 2007-7-7 11:23:40 > top of Java-index,Security,Event Handling...
# 2
what do you mean by command line arguments
dannyd73 at 2007-7-7 11:23:40 > top of Java-index,Security,Event Handling...
# 3
i'm new to this. how do i give command line arguments?
dannyd73 at 2007-7-7 11:23:40 > top of Java-index,Security,Event Handling...
# 4
You ran it as java filecopierYou need to tell it the names of the input and output files. E.g. java filecopier from.txt to.txt
YATArchivist at 2007-7-7 11:23:40 > top of Java-index,Security,Event Handling...
# 5
You knew enough to ask your code to use them.Did you just crib this from an example?%
duffymo at 2007-7-7 11:23:40 > top of Java-index,Security,Event Handling...