In this blog, I am going to explain about "How to open executable (.exe) application using java?". We will learn to open .exe file using Java and later you can use this to run any .exe file for future programs.
Below is the example Java program to open Notepad.exe file from the system.
Below is the example Java program to open Notepad.exe file from the system.
Java Source code:
package com.helloselenium.selenium.test; import java.io.IOException; public class OpenExeFile{ try { Runtime runtime = Runtime.getRuntime(); runtime.exec("C:\\Windows\\System32\\Notepad.exe"); } catch (IOException e1) { e1.printStackTrace(); } }
Below are the line by line code explanation for above Java program:
package com.helloselenium.selenium.test;
Following code is the required packages to handle Java IOException.
import java.io.IOException;
Runtime runtime = Runtime.getRuntime();
runtime.exec("C:\\Windows\\System32\\Notepad.exe");
0 Comments
What would you like to add in my list? I look forward to reading your comments below.