爪哇 - C-像叉? [英] Java - C-Like Fork?

查看:91
本文介绍了爪哇 - C-像叉?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能做一个C像在Java中叉,采用新的独立JVM进程?

Is it possible to do a "C like" fork in java, using an new independent jvm process ?

如何?

推荐答案

有趣地,我只是在做这个:在运行其他Java程序的Java进程。我以前的文章从的Runtime.exec()来的ProcessBuilder 作为一个坚实的基础,并的当的Runtime.exec()不会的一个很好的建议如何狼吞虎咽的输出流。

Funnily, I am just working on this: a Java process running other Java processes. I used the article From Runtime.exec() to ProcessBuilder as a solid base, and When Runtime.exec() won't as a good advice how to gobble the output streams.

PS:对于那些想知道,我不得不这样做(而不是产生新的线程),由于另一个Java进程正在检查这些过程这是,通常情况下,分别与shell命令运行的presence。

PS.: For those wondering, I had to do that (instead of spawning new threads) because yet another Java process is checking the presence of these processes which are, normally, ran separately with shell commands.

这篇关于爪哇 - C-像叉?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆