java program launch exe file

www.‮tual‬turi.com
java program launch exe file
/**
 * @author lautturi.com 
 * Java example: launch /execute exe file in java
 */


import java.util.*;
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

public class Lautturi {
	public static void open(String targetFilePath) throws IOException {
		Desktop desktop = Desktop.getDesktop();
		desktop.open(new File(targetFilePath));// open the file
	}

	public static void main(String[] args) throws IOException {

		// the absolute path
		// String path = "F:\\folder\\text.exe"; // OR
		String path = "F:/folder/text.exe";
		open(path);

	}
}
Created Time:2017-09-25 23:38:45  Author:lautturi