• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to run a exe file in java by taking parameters

 
Nedunoori cnu
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
Eclipse IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic