Call an EXE from Mendix UI?

I want to call exe from Mendix. This exe perform posprocessing logic for some file format. I want to provide a GUI for workflow and call this exe within. Is this possible or a way to do it?
2 answers

Yes possible with the method Runtime.getRuntime().exec in a custom Java action, where you can open, write and execute the command in cmd.exe, example


		//sox audio.wav --channels=1 --bits=16 audio.flac
		Process p = Runtime.getRuntime().exec("cmd /c start "cd C:\\Users\\SK\\Documents\\Mendix\\NativeMobile-main\\sox\\  "
				+ "&& sox" + UUID+".wav --channels=1 --bits=16 "+UUID+".flac"
				+ "&& exit");


Additional sources;





        var process = new java.lang.ProcessBuilder(
        var is = process.getInputStream();
        var isr = new;
        var br = new;
        var line;
        var str_ret='';
        while ((line = br.readLine()) != null) {

You might also want to store stdout/stderr and return code in some mendix table

Probably better to build something that can execute shell scripts or batch scripts, and then store that in a table, then you

can edit it at runtime, and additionally set up a scheduling system for your scripts

Processbuilder is slightly different from Sinan’s answer in that the flags are split over the member function varargs section