英文:
Execution of programs in another Java program
问题
有没有办法在另一个Java程序内运行一个程序(也许是C、C++、Java或Python),并获取输出。
我正在用Java开发一种代码编辑器和一种类似HackerRank的网站,我希望这个代码编辑器也能执行程序。
我尝试在Java中使用
>Runtime.getRuntime().exec("python Program.py")
但我觉得效果并不太令人信服。有没有其他方法可以实现这个?
英文:
Is there any way to run a program (maybe C, C++, Java or Python) inside another Java program and get output.
I am developing a kind of Code-Editor and a kind of HackerRank clone with Java and I want the code editor to execute the program as well.
I have tried using
>Runtime.getRuntime().exec("python Program.py")
in Java. But I do not find it that convincing. Is there any other way to achieve this??
专注分享java语言的经验与见解,让所有开发者获益!
评论