import java.io.File;
public class OpenAnyFile {
public static void main(String[] args) {
File ff = new File("C:\\Users\\Desktop\\sylabus.docx");
open_files(ff.getAbsolutePath());
}
public static void open_files(String abspath) {
try {
Runtime r = Runtime.getRuntime();
String path = "cmd.exe /c start \"\" /max \"" + abspath + "\"";
System.out.println("path = " + path);
Process p = r.exec(path);
} catch (Exception e) {
e.printStackTrace();
}
}
}
No comments:
Post a Comment