Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

launch an .exe file giving arguements

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
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 ...??
 
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
Hope this helped you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top