External program from our Java program

后端 未结 5 647
半阙折子戏
半阙折子戏 2020-12-11 11:55

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

5条回答
  •  一生所求
    2020-12-11 12:40

    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.

提交回复
热议问题