i am not able to get the system2 result. tried to execute the sample jar file.
execute_system.R:
workingDir <- \"C:/Code\"
setwd(work
Using your code, it worked for me without error when I did the following:
system2('java', args = c('-jar', 'sample.jar', '123'),
stdout = 'stdout.txt', stderr = 'stderr.txt')
I ran this on Mac OSX 10.10.5 (Yosemite). The results were printed to "stdout.txt".
It seems from the documentation for system2
, the first option is just a command (i.e. no arguments). The arguments are to be specified with the args
parameter.
Here is a snippet from the Details section:
Details
Unlike system, command is always quoted by shQuote, so it must be a single command without arguments.
...