I am trying to create a Java (not javascript, but I could include it for sure) webserver which will be able to print a live console from another Java program to a webpage. I know how to make the Java webserver, and I know how to access the Input and Output streams for the other running Java program, but I do not know how to send console output and get console input from the webpage the person is viewing.
I could use html and have the page reload every half second, but then no one could type anything to send to the console.
Someone recommended I use ASP, but I have no idea where to even start.
To recap, I want to send and show live data to a webpage and receive live user input back to the webserver.
For reference, I am using the following for the output I want to send to the webpage:
ProcessBuilder pb = new ProcessBuilder("java", "-jar", "my.jar");
pb.directory(new File("C:/Users/Michael Forseth/Desktop/Server Stuff/Test Moltres/TEST SERVER"));
final Process p = pb.start();
InputStream in = p.getInputStream();
InputStreamReader ins = new InputStreamReader(in);
BufferedReader br = new BufferedReader(ins);
String line;
while((line = br.readLine()) != null){
//Send "line" to webpage for user to see
System.out.println("CONSOLE: " + line);
}