File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes How to run a exe file in java  by taking parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to run a exe file in java  by taking parameters" Watch "How to run a exe file in java  by taking parameters" New topic
Author

How to run a exe file in java by taking parameters

Nedunoori cnu
Greenhorn

Joined: Dec 21, 2006
Posts: 1
Hi Everybody,
please help me to solve this problem.

PROBLEM :

String[] cmd = { "D:\\Program Files\\eRightSoft\\SUPER\\ffmpeg.exe","D:\\AVI\\NEURO01.avi","D:\\AVI\\FlashFile.flv" };
Runtime.getRuntime().exec(cmd);

My task is to run the FFMPEG.EXE file that takes the first parameter source file and the second parameter is the destination file format and convert to the destinatio file format i.e(to second parameter type). All this has to happen in a java code. im able to run the exe file but unable to convert to the distination file format.

Please help me to sove this as soon as psiible its urgent.

Thankyou,

Srinivas.N
Chris Beckey
Ranch Hand

Joined: Jun 09, 2006
Posts: 116

1.) Can you run the conversion program from the OS command line?
2.) Are you wating for the result from the exec() call? i.e. Process.waitFor() or Process.exitValue() ?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12836
    
    5
If the FFMPEG program writes anything to standard out or err streams (they would show up when running from the command line) you must provide for reading those streams for consistent behavior. See the JavaDocs for java.lang.Process - this comes up alot, search this forum for "exec"
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to run a exe file in java by taking parameters