kevin shen
September 15th, 2000, 11:56 AM
How can I run an .exe file in java?
thank you!
Best Regards,
Kevin Shen
thank you!
Best Regards,
Kevin Shen
|
Click to See Complete Forum and Search --> : How can I run an .exe file in java? kevin shen September 15th, 2000, 11:56 AM How can I run an .exe file in java? thank you! Best Regards, Kevin Shen VipulPathak September 15th, 2000, 01:08 PM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |