我已经看过这个帖子,但是我还有一个问题:在java中启动vlc播放器 看起来VLC的Java绑定不再处于活动开发状态,并且无论如何都不支持命令行上的所有内容.
鉴于以下代码,我无法从Mac OS 10.5.8(Java 1.6)上的Java应用程序启动VLC,然后通过终端或其他Java应用程序通过rc接口连接到它.
public class Main {
public static void main(String[] args) {
String s = null;
try {
//Process p = Runtime.getRuntime().exec("/Applications/VLC.app/Contents/MacOS/VLC -I telnet --telnet-host=localhost:4442 -I rc --rc-host=localhost:4444");
//Process p = Runtime.getRuntime().exec("/Applications/VLC.app/Contents/MacOS/VLC -I rc --rc-host=localhost:4444");
//ProcessBuilder pb = new ProcessBuilder("/Applications/VLC.app/Contents/MacOS/VLC","-I rc","--rc-host=localhost:4444");
ProcessBuilder pb = new ProcessBuilder("/Applications/VLC.app/Contents/MacOS/VLC","-IRC","--rc-host=localhost:4444");
Process p = pb.start();
StreamGobbler errorGobbler = new StreamGobbler(p.getErrorStream(), false);
StreamGobbler inputGobbler = new StreamGobbler(p.getInputStream(), false);
errorGobbler.start();
inputGobbler.start();
System.out.println("Waiting: \n"+p.waitFor());
System.out.println("All done here");
//p.destroy();
//System.exit(0);
} catch (IOException ioe) …Run Code Online (Sandbox Code Playgroud)