Jun 12, 2001 #1 Guest_imported New member Joined Jan 1, 1970 Messages 0 I want to execute an .exe file from inside a java program . I am supposed to provide arguements to the .exe file while calling . Can some one help me ...??
I want to execute an .exe file from inside a java program . I am supposed to provide arguements to the .exe file while calling . Can some one help me ...??
Jun 13, 2001 #2 Vepo Programmer Joined Apr 25, 2001 Messages 75 Location SE Hi ManasRanjan, You can launch executable programs by using java's Runtime class. It's very simple operation, here is one recycled example import java.io.*; public class ExcecTest { public static void main(String[] argv) { String[] args = {argv[0], argv[1]}; // argv[0] = program you want to start // argv[1] = parameter to program try { Runtime.getRuntime().exec(args); } catch(IOException ioe) { System.out.println(ioe.toString()); } } } You can find more information from http://java.sun.com/j2se/1.3/docs/api/index.html Hope this helped you. Upvote 0 Downvote
Hi ManasRanjan, You can launch executable programs by using java's Runtime class. It's very simple operation, here is one recycled example import java.io.*; public class ExcecTest { public static void main(String[] argv) { String[] args = {argv[0], argv[1]}; // argv[0] = program you want to start // argv[1] = parameter to program try { Runtime.getRuntime().exec(args); } catch(IOException ioe) { System.out.println(ioe.toString()); } } } You can find more information from http://java.sun.com/j2se/1.3/docs/api/index.html Hope this helped you.