I am using below code,
Runtime runTime = Runtime.getRuntime();
Process p = runTime.exec("javac C:\\testDemo\\Demo.java");
p.waitFor();
Process p2= Runtime.getRuntime().exec("java Demo.class");
p2.waitFor();
it is creating a .class file, but its unable to run this program. do i need to do any change in Runtime.getRuntime().exec("java Demo.class"); method?