How to pass command or argoman to a process in java
I want to run a program called VLC in java. I created it's process by Runtime. I don't know how to pass commands to this process. Also VLC program can be controlled via command line. I want to set a Port and IP address to VLC program listen to streaming data. Every process in java has InputStream and OutputStream.
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe");
DataInputS开发者_StackOverflowtream in = new DataInputStream(p.getInputStream());
OutputStream out = p.getOutputStream();
thank you, sajad
Javadoc is your friend : http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String[])
There is a version of exec which accepts a String array for the command and its arguments.
精彩评论