![]() Further we have to directly connect its output channel to the Java process’ output channel, which works starting with Java 7, using inheritIO(): import java.io. To solve this problem, we have to invoke the command line interpreter ( cmd) and tell it to execute a command ( /c cls) which allows invoking builtin commands. But when the output of the cls command gets redirected, it doesn’t clear the console. When launching a new process via Runtime.exec, the standard output gets redirected to a pipe which the initiating Java process can read. There is no executable named cls.exe or cls.com in a standard Windows installation that could be invoked via Runtime.exec, as the well-known command cls is builtin to Windows’ command line interpreter. If you really deleted the file, then it’s probably gone (absent some sort of file recovery software miracle, but that has nothing to do with R). ![]() I’m afraid that in general, there’s nothing special about R script files in this situation they’re just plain text files. This command does not work, for two reasons: Accidentally deleting files is no fun at all. Since there are several answers here showing non-working code for Windows, here is a clarification: Runtime.getRuntime().exec("cls")
0 Comments
Leave a Reply. |