I am playing around with some GIT commands in terminal, but I want to write a java program to automate the process.Please note I am not writing a program straight into a terminal. I am writing it in eclipse. This following code works on windows, but not MAC. How should I change it to run on MAC?
import java.io.*;
public class NewClass {
public static void main(String[] args) {
try {
Process p = Runtime.getRuntime().exec("GIT");
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
GITin the mac console works?