在另一个Java程序中执行程序

huangapple 未分类评论47阅读模式
英文:

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??

huangapple
  • 本文由 发表于 2020年7月23日 23:36:42
  • 转载请务必保留本文链接:https://java.coder-hub.com/63057971.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定