aspose file tools
The moose likes Java in General and the fly likes Runtime.exec() Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Runtime.exec()" Watch "Runtime.exec()" New topic
Author

Runtime.exec()

Vinod Kumar
Ranch Hand

Joined: Jan 18, 2002
Posts: 75
Hi all,
I need to call an exe file from java.
I tried to do like this:
Runtime rt = Runtime.getRuntime();
rt.exec("myfile.exe");
it does not call my exe at all.even i tried out with simple .bat file.
I am working on windows NT.
Help please,
Thanx in advance,
Vinod Pai
Kiran Kumar
Ranch Hand

Joined: May 18, 2001
Posts: 107

put your exe or bat file in the path of the OS.
put the path to ur .exe in the path environment variable. then runtime.exec will be able to execute it.
like
path = c:\temp\myexe.exe;


Thanks<br /> <br />Kiran <br /> <br />SCEA, SCJP 1.4,<br /> <br />"First they ignore u, then they laugh at u, then they fight u, <br />then u will win<br /> <br />Mahatma Gandhi"
Steve Deadsea
Ranch Hand

Joined: Dec 03, 2001
Posts: 125
And if your path has spaces in it, make sure you call it like this:
Runtime rt = Runtime.getRuntime();
rt.exec(new String[] {"c:\my stuff\myexe.exe"});
 
I agree. Here's the link: jrebel
 
subject: Runtime.exec()
 
Similar Threads
.class file into .exe file
JNI
how to open a .class file ? can not open with text editors!
Running an exe in tomcat
Calling .Net exe file from java