Top.Mail.Ru
June 4th, 2005 - Java developers — LiveJournal
? ?

Java developers

June 4th, 2005
Image

01:03 am - Imagesourpatchkid

Does anyone know why I'm getting this error...
C:\_JavaTest>javac ReadFilesTest.java
ReadFilesTest.java:18: cannot find symbol
symbol  : constructor File(java.io.File)
location: class java.io.File

File inputFile = new File( strFilesDirs[i] );
                 ^
1 error


code
import java.io.*;
import java.util.*;

class ReadFilesTest {
	public static void main (String[] args) throws IOException {
		
		String filedir;
		
		//root dir
		File f1 = new File ( "C:\\_JavaTest\\" );
		
		
		File[] strFilesDirs = f1.listFiles ( );
		
		for ( int i = 0 ; i < strFilesDirs.length; i ++ ) 
		{
			
			File inputFile = new File( strFilesDirs[i] );
			File outputFile = new File("xml.txt");
			
			FileReader in = new FileReader(inputFile);
			FileWriter out = new FileWriter(outputFile);
			
			int c;
			
			while ((c = in.read()) != -1)
			out.write(c);
			
			in.close();
			out.close();
			
		}
	}
}


Thanks in advance.
Powered by LiveJournal.com
Image