Hi all I am trying to make online java compiler.
As a initial POC I am able to compile and run program having no input statements but I dont'd know what to do if there are input statements also.
I am using Runtime.getRuntime().exec to compile and run input java program.
Sample program having input statements that I am trying to run and execute is :
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello world..................");
Scanner sc = new Scanner(System.in);
System.out.println("Enter Name");
String name = sc.nextLine();
System.out.println("you entered " + name);
sc.close();
}
}
Problem is when I compile and run above program through my code which compiles and runt it I am getting "Enter Name" of System.out.println("Enter Name"); in HelloWorld.java but after that nothing happens.