
How to execute cmd command through java?? Give Code of them..

Try the given code :
try {
// Execute a command without arguments
String command = "ls";
Process child = Runtime.getRuntime().exec(command);
// Execute a command with an argument
command = "ls /tmp";
child = Runtime.getRuntime().exec(command);
} catch (IOException e) {
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.