Dear All,
I am doing a very simple IO Stream program from Sun Java Tutorial Website. All of the codes go fine but the problem is got a File not found Exception. I have no idea about that. By the way, I am using Indigo Eclipse in Mac OS as may be this can also be the problem. The following is your reference. Please kindly see my codes and give me some valuable suggestions. Thanks and Regards.
Sha Zay
package basicIO;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
public class CopyBytes {
public static void main(String[] args) throws IOException {
FileInputStream in = null;
FileOutputStream out = null;
try {
in = new FileInputStream("xanadu.txt");
out = new FileOutputStream("outagain.txt");
int c;
while ((c = in.read()) != -1) {
out.write(c);
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("File Cannot be found!!!");
} finally {
if (in != null) {
in.close();
}
if (out != null) {
out.close();
}
}
}
}