How can I write a program in Java that will execute another program? Also, the input of that program should be given from our program and the output of that program should b
Please do not edit your question so that it does not fit the original answers anymore. If you have follow-up question, clearly mark them as such, or ask them as a seperate questions, or use comments or something.
As for your IOException, please give the error message it shows.
Also, it seems as if you are trying to run a ".java" file directly. That will not work. The methods described here are to launch native binary executables. If you want to run a ".java" file, you have to compile it to a class, and the invoke that class' main method.