problem opening files
import java.io.*;
import java.io.File;
import java.io.FilenameFilter;
publicclass FileDetect{
publicstaticvoid main(String args[]){
File f=new File("f:/");
if(f.exists()){
for (File file : f.listFiles()){
File[] files = f.listFiles(new FileFilter(){
publicboolean accept(File file){
return file.isFile()&& file.getName().toLowerCase().endsWith(".doc");
}
});
System.out.println(file);
try{
Runtime.getRuntime().exec(new String[]{"cmd","/c","start"+file});
}
catch (Exception x){
x.printStackTrace();
}
catch (Error e){
e.printStackTrace();
}
}
}
}
}
hi all, from the code above i want to run all the files that end with .doc but when i compiled it only display the file contents, how do i want to execute .doc files only?
thank you
jp

