1

我想在 java 中运行一个名为 VLC 的程序。我通过运行时创建了它的进程。我不知道如何将命令传递给这个进程。VLC 程序也可以通过命令行控制。我想为 VLC 程序设置一个端口和 IP 地址来监听流数据。java中的每个进程都有InputStream和OutputStream。

        Runtime rt = Runtime.getRuntime();
        Process p = rt.exec("C:\\Program Files\\VideoLAN\\VLC\\vlc.exe");
        DataInputStream in = new DataInputStream(p.getInputStream());

        OutputStream out = p.getOutputStream();

谢谢你,萨贾德

4

1 回答 1

2

Javadoc 是你的朋友: http: //download.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html#exec(java.lang.String[])

有一个 exec 版本,它接受一个字符串数组作为命令及其参数。

于 2010-09-09T12:46:29.110 回答