Java equivalent of fork in Java task of Ant?
问题 Ant Java task provides fork parameter, which, by definition "if enabled triggers the class execution in another VM" . As we are dealing with a large amount of data, setting this parameter saved us from running out of Java heap space. We want to be able to do the same through a Java class. What would be the best way to achieve the functionality as provided by fork ? 回答1: Execute another java process. By using ProcessBuilder class, for example. http://java.sun.com/javase/6/docs/api/java/lang