I have a Query generated by my Java Program in Query Variable. I want to send this to SWI-Prolog to get the solution of this. The following shows the subcode I wrote in Java to communicate with SWI-Prolog.
Process P= new ProcessBuilder("C:\\Program Files\\swipl\\bin\\swipl-win.exe").start();
BufferedReader processOutput = new BufferedReader(new InputStreamReader(P.getInputStream()));
BufferedWriter processInput = new BufferedWriter(new OutputStreamWriter(P.getOutputStream()));
String commandToSend = Query;
processInput.write(commandToSend);
But the SWI-Prolog Window opens up but the comand I am writing to ProcessInput is not being sent to SWI-Prolog. Can someoe suggest me the best way to do this? I need the output of the Query Execution from SWI-Prolog in a File as well.