|
-
September 15th, 2000, 11:56 AM
#1
How can I run an .exe file in java?
How can I run an .exe file in java?
thank you!
Best Regards,
Kevin Shen
Best Regards,
Kevin Shen
-
September 15th, 2000, 01:08 PM
#2
Re: How can I run an .exe file in java?
Hi !
You should you the Runtime and Process classes to Perform this. Below is a small Program, that will Illustrate this for you.
/** RunFromJava.java : Demonstrates, How to Execute a Program from within Java */
import java.lang.* ;
public class RunFromJava
{
public static void main(String[] args)
{
Runtime r = Runtime.getRuntime();
Process p = null;
try
{
p=r.exec("Freecell"); // Starts the "Free Cell" Game
p.waitFor();
}
catch (Exception e)
{
System.out.println("Error executing C" + e.toString());
}
}
}
Hope this helps.
Enjoy Java.
-Vipul Pathak.
Pathak Developers Pvt. Ltd.
Indore, (MP) INDIA.
PS: If this helps you then Rate it, so let me know How much is this helpful to you.
(*Vipul)() ; 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|