I'm trying to run MixTex from a Java program, using the runtime.exec method. The code is
try {
Process process = Runtime.getRuntime().exec("miktex-pdf[--output-directory=(directory)][TestFile.tex]");
} catch (IOException ex) {
Logger.getLogger(CitationMachine.class.getName()).log(Level.SEVERE, null, ex);}
I'm getting an error saying that they can't find the program. I ve read Run .exe file in Java from file location but don't know how to adapt this to include the options and specify the tex file to be compiled. The documentation for latex command line I want to use is found at https://docs.miktex.org/manual/pdftex.html. Full documentation for other commands is found https://mirrors.sorengard.com/ctan/systems/win32/miktex/doc/2.9/miktex.pdf.
I want to specify the output directory of the file, the directory where the .tex file is located, and the name of the tex file
What am I doing wrong? Can you tell me how to fix my code or what would be a "better" way to run compile a tex document as part of a java program?
I know Apache POI exists, but I don't know how to use it and I'm already familiar with LaTex and know that I should be able to compile a pdf that way.