我正在尝试使用终端命令latex file.tex
来编译.tex文件。我的程序在字符串上提取.tex文件的绝对路径:
public void generateLatex(String path)
{
String file = path;
//...compile file;
}
是否有在给定路径上使用命令的方法?我尝试使用过程
Process p = Runtime.getRuntime().exec(executable + path);
p.waitFor();
但是它不起作用
您可以使用流程构建器:
ProcessBuilder pb = new ProcessBuilder("latex", "yourlatex.tex")
.inheritIO()
.directory(new File("your directory path"));
Process process = pb.start();
process.waitFor();
con amor todo entra tu sigue intentandocampeón