如何从Mac中的Java程序编译LaTex文件

问题描述 投票:0回答:2

我正在尝试使用终端命令latex file.tex来编译.tex文件。我的程序在字符串上提取.tex文件的绝对路径:

public void generateLatex(String path)
{
    String file = path;
    //...compile file;
}

是否有在给定路径上使用命令的方法?我尝试使用过程

Process p = Runtime.getRuntime().exec(executable + path);
p.waitFor();

但是它不起作用

java macos latex pdflatex
2个回答
1
投票

您可以使用流程构建器:

ProcessBuilder pb = new ProcessBuilder("latex", "yourlatex.tex")
            .inheritIO()
            .directory(new File("your directory path"));
Process process = pb.start();
process.waitFor();

0
投票

con amor todo entra tu sigue intentandocampeón

© www.soinside.com 2019 - 2024. All rights reserved.