Results 1 to 1 of 1
-
How to execute an External Program through Java program
This example program will execute the external commands and capture the output.
Java Code:import java.io.*; public class CommandExection { public CommandExection(String commandline) { try { String line; Process p = Runtime.getRuntime().exec(commandline); BufferedReader input = new BufferedReader (new InputStreamReader(p.getInputStream())); while ((line = input.readLine()) != null) { System.out.println(line); } input.close(); } catch (Exception err) { err.printStackTrace(); } } public static void main(String argv[]) { new CommandExection("c:\\CompChamps.exe"); }
Similar Threads
-
External Program execution problems
By vital101 in forum Advanced JavaReplies: 3Last Post: 10-30-2007, 06:17 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 10:33 PM -
Use a external file in my program
By romina in forum New To JavaReplies: 1Last Post: 08-07-2007, 06:28 AM -
Execute a new program in java
By mathias in forum Advanced JavaReplies: 1Last Post: 07-31-2007, 06:42 AM -
Need to write a program to execute a list of system commands
By mdthahir in forum NetworkingReplies: 1Last Post: 07-27-2007, 06:46 PM
Bookmarks