when I execute this class in an IDE from main
,everything works fine:
Runtime p = Runtime.getRuntime();
String[] commands = new String[3];
commands[0] = "cmd";
commands[1] = "/c";
commands[2] = "\\something\\something\\curl.exe ... ;
Process x = p.exec(commands);
BufferedReader in = new BufferedReader(
new InputStreamReader(x.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
but if I build WAR and execute this method from web application - The line containing null (p.exec(commands)
- does not work correctly), How do I improve this situation ?