I'm trying to run R.exe from a Java application with Java exec. R is in the Environment Variables and if I execute it from cmd with "R" command it works. If I execute an example instruction in Java and try to open notepad it works:
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("notepad");
But when I try to open R with this instruction:
Process p = rt.exec("R");
it gives me this kind of error:
java.io.IOException: Cannot run program "R": CreateProcess error=2
what could be? why cant I open R from Java?