开发者

java LocalExecute process exit value 127

I'm writing a java program running at Linux. Below is the java method

createHinted3gpFile (String localfile) {
    ArrayList<String> cmdArray = new ArrayList<String>();
    String hintedFile = localfile+".hint";
    cmdArray.add("cp");
    cmdArray.add(localfile);
    cmdArray.add(hintedFile);
    System.out.println ("Command ="+cmdArray);
    LocalExecute.exec(cmdArray.toAr开发者_如何学Pythonray(new String[1])); 
    cmdArray = new ArrayList<String>(); 
    cmdArray.add("/usr/local/bin/MP4Box");
    cmdArray.add("-3gp");   
    cmdArray.add("-hint");
    cmdArray.add(hintedFile);
    System.out.println ("Command ="+cmdArray);
    LocalExecute.exec(cmdArray.toArray(new String[1]));

}

and the output

Command =[/usr/local/bin/MP4Box, -3gp, -hint, /opt/myproject/contents/29443b_3gp.hint] [INFO] 10 Nov 03:23:00.467 PM http-8080-2 [myproject.transcoders.LocalExecute] Process exitValue: 127

The Process exitValue should be 0 if everything went ok. Since last week i get this 127 value! Any ideas about what happened?

Thanks Antonis


/usr/local/bin/MP4Box, -3gp, -hint, /opt/myproject/contents/29443b_3gp.hint

Perhaps these commas are the reason for your exit value.

How do you run this from command line? Perhaps this way?

/usr/local/bin/MP4Box -3gp -hint /opt/myproject/contents/29443b_3gp.hint

If yes, then you need to strip out the commas before execution.

Edit: from your comment, the commas are problematic.

I think you're overcomplicating your method. This should be easier on the eyes:


createHinted3gpFile (String localfile) {
    Runtime.getRuntime().exec("/usr/local/bin/MP4Box -3gp -hint " + localfile + ".hint");
}


127 means "command not found". /usr/local/bin/MP4Box, - is there a comma really?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜