Searching...
Friday, 22 November 2013

How to run external application from java

21:46

Java Runtime that allows the application to interface with the environment in which the application is running. The getRunTime().exec() method allows to execute external application from java.

Example

package com.pretech;
import java.io.IOException;
public class JavaRunTimeExample {
	public static void main(String[] args) {
		try {
			Runtime.getRuntime().exec("notepad.exe c:/pretech.txt");
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

Output



image


0 comments: