How to open any file using java
We need File and Desktop modules for this program
import java.awt.*; import java.io.File; import java.io.IOException; public class OpenFile { public static void main(String args[]) { File f = new File("filepath.exe"); Desktop d = Desktop.getDesktop(); try { d.open(f); } catch (IOException i) { System.out.println(i); } } }
Comments
Post a Comment