What is the purpose of Process class in Java?
Posted
by Nitesh Panchal
on Stack Overflow
See other posts from Stack Overflow
or by Nitesh Panchal
Published on 2010-05-09T17:02:38Z
Indexed on
2010/05/09
17:08 UTC
Read the original article
Hit count: 145
java
Runtime objRuntime = Runtime.getRuntime();
String strBackupString = "mysqldump -u " + userName + " -p" + password + " " + dbName;
Process objProcess = objRuntime.exec(strBackupString);
This is used for backup of database. But what exactly happens? Can anybody make me explain, what is the purpose of Runtime and Process class?
Is this class used to act as if we are typing command from command prompt? Then what should i pass to objRuntime.exec() if i want to open notepad? And is the command executed as soon as we call exec method? If yes, then what purpose does Process serve here? I really can't understand these two classes. Please make me understand. Thanks in advance :)
© Stack Overflow or respective owner