java 可以执行二进制文件吗?
我有一个用 Java、Ada、C 和 Python 编写的二进制文件列表,我想执行它们。 我怎样才能做到这一点? 这些语言有 JVM 绑定吗?
I have a list of binaries written in Java, Ada, C, and Python and I want to execute them.
How can I do that?
Are there any JVM binding to those languages?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您只想执行现有应用程序,则可以使用
java.io.runtime
命名空间。If all you want to do is execute existing applictions, you can use the
exec
methods from thejava.io.runtime
namespace.是的。以下是关于如何执行此操作的优秀博客文章的链接:在 Java 中运行系统命令。
其要点是,您需要执行以下操作:
您几乎可以在其中放置任何命令,但我遇到的唯一问题是要注意系统环境变量,例如运行 JVM 的 PATH。
Yes. Here is a link to a good blog article on how to do it: Running system commands in Java.
The gist of it is that you need to do the following:
You can pretty much put any command in there but the only gotcha that I have encountered in be aware of system environment variables like the PATH that you are running your JVM in.
如果您想与二进制 API 交互,请使用:
If you want to interact with the binary API's, use: