Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;
import java.io.IOException;

public class Main {
    public static boolean copyFile(String src, String dest) {
        File test = new File(dest);
        if (!test.exists()) {
            test.mkdirs();
        }
        Process p;
        try {
            p = Runtime.getRuntime().exec("cp " + src + " " + dest);
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        try {
            p.waitFor();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return true;
    }
}