下面给出的代码是我尝试在eclipse中运行的代码,它返回stdInput.readLine()为空,当我尝试通过命令提示符运行命令时它运行成功我在做什么错误?代码在命令提示符下运行但不在eclipse中运行
public class Recognize {
public String Recog(String name)
{ try {
String command="java -cp .;C:\\mywork\\Speaker\\marf-0.3.0-devel-20070108-fat.jar SpeakerIdentApp --ident C:\\mywork\\Speaker\\testing-samples\\"+name+".wav";
Process proc = Runtime.getRuntime().exec(command);
BufferedReader stdInput = new BufferedReader(new InputStreamReader(proc.getInputStream()));
BufferedReader stdError = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
name = "";
String s ;
System.out.println(stdInput.readLine());
// read the output from the command
// System.out.println("Here is the standard output of the command:\n");
while ((s=stdInput.readLine()) != null){
// System.out.println(s);
String recog = s;
// System.out.println(recog);
String ex = stdInput.readLine();
// System.out.println(ex);
String sb = stdInput.readLine();
// System.out.println(sb);
if (recog.equalsIgnoreCase(ex))
{//System.out.println("ACCESS GRANTED");
name = recog;
// System.out.print(recog);
}
else if (ex.equalsIgnoreCase(sb))
{//System.out.println("ACCESS GRANTED");
name = ex;
// System.out.println(ex);
}
else {//System.out.println("ACCESS DENIED");
name = "";
}
2013-04-13
tina
+0
尝试在类路径CLASS“SpeakerIdentApp”指定目录位置或JAR文件名 –
+0
在蚀或在我的系统?? –
+1
In line java -cp。; C:\\ mywork \\ Speaker \\ m ... –