windows - Execute command prompt commands in java -


i want write java program , in need execute batch file convert mp3 wav file,am having command , working fine in command prompt,so convert file wave mp3 first step have change directory batch file presents , need execute mu-law-mp3.bat muic command in command prompt question how can achieve through java?

in java program

  1. i need execute cd command location of batch file
  2. i need execute above command .

here 1 way of doing it.you can specify location of file in command itself.

  processbuilder pb=new processbuilder(command);     pb.redirecterrorstream(true);     process process=pb.start();     bufferedreader instreamreader = new bufferedreader(         new inputstreamreader(process.getinputstream()));       while(instreamreader.readline() != null){         //do commandline output.     } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -