I want to run a compiled Java/C code by an external Java program. Problem is compiled Java/C code directs all input and output to standard devices but I want that external program to handle its input and output in real-time, like a user.
You can use Runtime and Process Class
//Sample Code
Runtime compileRuntime = Runtime.getRuntime();
Process compileProcess = compileRuntime.exec("javac MyClass.java");
and the returned Process class object has an input and output stream.
see this for more details.
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Runtime.html http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Process.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.