This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Java in General and the fly likes Runtime.getRuntime().exec doesnt execute some files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Runtime.getRuntime().exec doesnt execute some files" Watch "Runtime.getRuntime().exec doesnt execute some files" New topic
Author

Runtime.getRuntime().exec doesnt execute some files

garfild Baram
Ranch Hand

Joined: Mar 24, 2003
Posts: 60
Hi helper,
I use in my code:

Process p = Runtime.getRuntime().exec(scriptToRun);

and it runs file1.cmd that containes the following:

file1.cmd:

set ADVANTAG_FOLDER=c:\Yoss_test
RD /s /q %ADVANTAG_FOLDER%


but it doesnt run file2.cmd :-(

file2.cmd:

echo "after File " >> after.txt


Do you have a clue why file1 is executed and file2 is not. I dont get any errors at all.

Thanks
Yossi
garfild Baram
Ranch Hand

Joined: Mar 24, 2003
Posts: 60
sorry for the trubles....

All files are executed ,I just looked for the results in the wrong place.

All good

Thanks

Yossi
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18494
    
  40

Are you sure it is not running? Or are you just having problems finding the "after.txt" file?

I would suggest that either you use the version of exec() that sets the working directory, or scan your disk to see where this file is.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18494
    
  40

Glad to see that you solved it on your own...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runtime.getRuntime().exec doesnt execute some files
 
Similar Threads
Running a program from a Java Application
tricky question
dos commands within java program???
Launching files programatically
open a file located on server