我尝试制作一个小的 Java 程序,它允许我搜索 twitch 流并在 livestreamer 和 vlc 中打开一个。
所以我有这个方法应该运行 livestreamer。
public static void runLiveStreamer(String channel, String quality) throws IOException{
String cmd = new String("livestreamer.exe twitch.tv/" + channel + " " + quality);
System.out.println(cmd);
Process proc = Runtime.getRuntime().exec(cmd);
return;
}
我运行我的代码,没有任何反应,它不会抛出异常或停止工作。如您所见,我有额外的代码行打印出我执行的命令。当我通过 cmd 运行它时,它工作正常。我怎样才能让它工作?
提前感谢您的帮助,对不起我的英语。