Here is what I have done:-
// compile
Runtime.getRuntime().exec("javac C:\\dir1\\dir2\\dir3\\Main.java");
// run
Runtime.getRuntime().exec("java C:\\dir1\\dir2\\dir3\\Main");
I am successfully able to compile this file but cannot run it. I have tried using exec("cd C:\\dir1\\dir2\\dir3") before using exec("java Main") but to no benefit. Any ideas?