Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.IOException;
import java.util.concurrent.TimeUnit;

public class Main {
    public static void runOSCommand(String command) {
        ProcessBuilder builder = new ProcessBuilder("/bin/sh", "-c", command);
        try {
            Process p = builder.start();
            p.waitFor(5000, TimeUnit.MILLISECONDS);
        } catch (IOException | InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}