+ 2

can we use cmd commands inside a java program?if yes then how?

in c++, you can clear the screen using clrscr() but i want to do the same in java too and for that I got runtime.getRuntime.exec("cls"); but it doesn't seem to work thats why i need help

4th Aug 2017, 2:29 AM
Ashu@17
Ashu@17 - avatar
1 Respuesta
+ 2
'cls' is a shell command interpreted by cmd.exe (command.com for older systems); it is not itself executable. To run these you have to execute the command interpreter first, which is blocked by Group Policy on SoloLearn. * By the way; I see a lot of people (everywhere, not just here) trying to clear screens in subprocesses. Just FYI, that doesn't make sense when a process is spawned just to do that (and then exits) -- it's not quite right.
4th Aug 2017, 4:18 AM
Kirk Schafer
Kirk Schafer - avatar