I tried that to change the color of the DOS window by doing:
Runtime.getRuntime().exec("color 0a");
But it doesn't work and shows me the current exception:
http://postimg.org/image/9o8xj54tf/
That line is in the main of the program.
I tried that to change the color of the DOS window by doing:
Runtime.getRuntime().exec("color 0a");
But it doesn't work and shows me the current exception:
http://postimg.org/image/9o8xj54tf/
That line is in the main of the program.
The 'color' command is actually not an executable binary and therefore cannot be executed outside of cmd.exe
.
If you want to open a MS-DOS window from Java, use this code:
Runtime.getRuntime().exec("cmd.exe /K color 0a");
or save your MS-DOS commands to a .bat file and run them in sequence using:
Runtime.getRuntime().exec("cmd.exe /K your_batch_file.bat");
Actually I found a method that works, which is the following:
It starts a process of cmd.exe with the command
And then redirects the output to the console.