我的电脑系统是XP,当我打开doc、txt或ppt之类的文件时,这段代码不起作用。我已经有office2007,但是没有错误信息,desktop.open(file)无法打开任何文件。有些电脑可以正常工作,为什么?
public boolean byDesktop(String path){
File file = new File(path);
if(file.isFile()){
Desktop desktop = Desktop.getDesktop();
try {
desktop.open(file);
} catch (IOException e) {
System.out.println(e);
}
return true;
}else{
return false;
}
}