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

[2210 byte] By [juniorprogrammera] at [2007-11-27 8:58:48]
# 1
Your current code doesn't access files in File[] files in the last part of your main() method.
hiwaa at 2007-7-12 21:25:30 > top of Java-index,Java Essentials,New To Java...
# 2
"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?"What do you mean by executing .doc files?
passion_for_javaa at 2007-7-12 21:25:30 > top of Java-index,Java Essentials,New To Java...