1

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.