apache-commons-exec을 사용하여 Java 프로그램에서 mathtext를 실행하려고합니다. 문제는 내가 java 프로그램에서 같은 명령을 실행할 때와 쉘을 통해 실행할 때 다른 결과를 얻고 있다는 것입니다. 쉘에서이 같은 그렇다면 실행 mathtext : 쉘에서다른 출력 - 명령 줄에서 mathtext를 실행할 때 및 apache-commons-exec를 사용하여 java 프로그램에서 명령을 실행할 때
./mathtext test.png "\$\frac{{\left({{p^2} - {q^2}} \right)}}{2}\$"
나는 완벽한 PNG 를 얻을 수 있지만-간부 아파치 - 평민을 사용하여 같은 일을 실행할 때
Map map = new HashMap();
map.put("target", new File(trgtFileName));
DefaultExecuteResultHandler resultHandler = new DefaultExecuteResultHandler();
Executor exec = new DefaultExecutor();
exec.setWorkingDirectory(/*I set the working directory where the mathtext is*/);
CommandLine cl = new CommandLine("./mathtext");
cl.addArgument("${target}");
cl.addArgument(latex);
cl.setSubstitutionMap(map);
// Logger.log4j.info("command is:::"+cl.toString());
ExecuteWatchdog watchdog = new ExecuteWatchdog(5000);
exec.setWatchdog(watchdog);
exec.execute(cl,EnvironmentUtils.getProcEnvironment(),resultHandler);
resultHandler.waitFor();
내가 얻을 이미지가 아닌 방정식하지만
누군가가 문제를 해결 좀 도와 주실 래요 원시 텍 문자열 :(? 나는 정확한 출력을 얻을 싶어요. 감사합니다.