guru java example

Copy file using Runtime class in Java

Welcome to

Here is the program to copy a file using operation system copy command using java program

public class RuntimeDemo {

public static void main(String[] args) {
try {
// create a process and execute notepad.exe
Process process = Runtime.getRuntime().exec("cmd.exe /c copy C:\\Users\\mmansoor\\Desktop");

} catch (Exception ex) {


Examples, FAQ, Tutorial, Learning, Questions, Answers from Guru Java