关于在java web项目中出现通过代码调用pdf2swf工具生成swf时遇到的问题
柯之梦 2012-12-25 02:50:10 本人在window7上部署的项目,可以正常由pdf转换为swf,但在linux上部署的项目,却报以下错误:
cannot open pdf文件,代码: // 先生成flash
String[] envp = new String[1];
envp[0] = "PATH=/app/bin/";
String command = "pdf2swf -z -s flashversion=9 \"" + sourcePath+ "\" -o \"" + destPath + fileName + "\"";
System.out.println("pdf command--------------------------------------------------------"+envp[0]+"=="+command);
System.out.println(command);
int exitValue =0;
Process pro = Runtime.getRuntime().exec(command);
try{
pro = Runtime.getRuntime().exec(command);
InputStreamReader ir=new
InputStreamReader(pro.getInputStream());
BufferedReader input = new BufferedReader (ir);
String line;
while ((line = input.readLine ()) != null){
System.out.println(line);
}//end try
exitValue = pro.exitValue();
} catch (java.io.IOException e){
System.err.println ("IOException " + e.getMessage());
}