Open a file:
Below code will open the desired file. Suppose I want to open a file Data.xls from C:\Folder , then I will give the path as "C:\\Folder\\Data.xls".
package packageName;
import java.awt.Desktop;
import java.io.File;
public static void main(String[] args) throws Exception {
Desktop desktop = Desktop.getDesktop();
File openFile = null;
openFile = new File("C:\\Folder\\fileName.fileExtension");
}
No comments:
Post a Comment