源码如下:
在客户端运行正常,但在服务器端运行就出现问题了(使用web调用代理的方式)
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import lotus.domino.AgentBase;
import lotus.domino.Database;
import lotus.domino.Session;
public class JavaAgent extends AgentBase {
/* (非 Javadoc)
* @see lotus.domino.AgentBase#NotesMain()
*/
public void NotesMain() {
try {
Session session = getSession();
Database db = session.getCurrentDatabase();
String fileName = "xml_dom_javascript.pdf";
String cmdStr = "cmd /c start D:\\IBM\\Lotus\\Domino\\data\\SWFTools\\pdf2swf.exe";
String savePath = "D:\\";
//增加语言包 解决中文乱码问题
String languagePath="D:\\SWFTools\\xpdf\\chinese-simplified";
// 要加"" 就是为了防止要转换的过程中,文件夹名字带有空格,导致失败
String sourcePath = "\"" + savePath + fileName + "\"";
String targetPath = "\"" + savePath
+ fileName.substring(0, fileName.lastIndexOf(".")) + ".swf"
+ "\"";
//String argsStr = " -t " + sourcePath + " -o " + targetPath + " -s flashversion=9 -s languagedir="+languagePath;
String argsStr = " " + sourcePath + " -o " + targetPath;
Runtime rn = Runtime.getRuntime();
Process p = null;
String cmd = cmdStr + argsStr;
try {
p = rn.exec(cmd);
/*p.waitFor();
p.destroy();
InputStreamReader ir = new InputStreamReader(p
.getInputStream()); LineNumberReader input = new
LineNumberReader(ir); String line; while ((line =
input.readLine()) != null) System.out.println(line);
*/
System.out.println(cmd);
} catch (Exception e) {
System.out.println("Error my exec ");
System.out.println(e);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
说明:
其中起到关键作用的就是cmd /c start 啦,即打开windows 下的命令行窗口