I have built a single line batch file: openscad -o %1 %2.
This code works when I run: export output.stl input.scad from my command prompt.
I need this to run in java so i use the code:
System.setProperty("user.dir", directory);
String command = "cmd export " + name + ".stl " + name + ".scad";
Process pr = rt.exec(command);
directory is the location of all files associated with this process, the .bat, .scad, openscad.exe. And test.stl should output in this directory as well.
I get no errors from java by doing this but the export never happens.
Am I doing something wrong with how I run this code. I know ProcessBuilder comes reccomended on similar posts but I don't know how the array works and can't find any good documentation or tutorials on running this.
Java code:
Runtime.getRuntime().exec("cmd.exe /c start " + directory + "\\export.bat " + directory+ " " + name + ".stl " + name + ".scad");
Batch File:
cd %1
openscad.exe -o %2 %3
exit
start and entering the correct directory is the fix.