integration of an executable (.exe file) in my mendix app

0
Hi all, i have an algorithm written in Delphi and i have it as an .exe file. The file is run and its output is a plan of orders. How can i call this .exe from my Mendix application and use its  output (i.e. plan of orders). Any simple technique ? Thanks.
asked
3 answers
0

I wouldn't know a solution to run a .exe server side. I do start a .exe from my Mendix app on the client. I start this executabe with an URL protocol handler.

 

You could add a web service call to your custom Delphi code that communicates the result back to your Mendix app. This will however always be async.

answered
0

If you really really want this, and you run the server on premise, and the server is a Windows server you can start an executable from a Java-action

 

Process process = new ProcessBuilder(
"C:\\PathToExe\\MyExe.exe","param1","param2").start();

You can never run this in any cloud. You probably need to open up some security holes in Java, which allow unwanted actions on your server.

answered
0

If you are allowed to run an exe on the server you could try to use this piece of java

Process process = new ProcessBuilder("C:\\PathToExe\\MyExe.exe").start();
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;

System.out.printf("Output of running %s is:", Arrays.toString(args));

while ((line = br.readLine()) != null) {
  System.out.println(line);
}

source

answered