Hi Im trying to open word file using java program. The program gives me the following error"
Cannot make a static reference to the non-static method open(File) from the type Desktop
I dont know how to fix this. Can you please help me. Thanks. Below is snippet of code.
@Override
public void actionPerformed(ActionEvent e) {
List<File> files;
File startingDirectory = new File("C:/Hello/");
try {
files = getFileListing(startingDirectory);
for (File file : files){
Desktop.open(file);
}
} catch (FileNotFoundException ex) {
System.out.println("File Not Found");
}