I am running a Java application that executes a script. The relevant code is
String command [] = new String [2];
command[0] = "customSearch";
command[1] = query;
Process process = Runtime.getRuntime().exec(command);
This code runs on Linux because I placed a script called customSearch in the /usr/bin directory. In a similar way, I created a batch file in Windows called customSearch.bat and made sure it is on the PATH. However, this Java code will not work on Windows because "Batch files alone are not executable" as this thread mentions.
So to get it to work on Windows, I would have to say
command[0] = "cmd /c start customSearch";
However, I do not want to do this because this won't work on Linux. How can I run the batch file on Windows without changing command[0] ?