Performance is essentially the same, because essentially the same thing happens in both cases. For example, on a UNIX / Linux platform:
- The current process is forked.
- The new child process executes the java command, passing the specified command line arguments.
- starting child JVM ...
There may be secondary differences in performance. For example, in the way that child standard input / output / error streams are processed by the parent, can be different. But usually you can forget about it.
[As @Amadan points out, using the class loader to run a Java application in the current JVM is much more efficient ... because it avoids the overhead of running a JVM, compiling JIT common code, etc. But the main minus (except for simplicity) is that there is no effective way for a "parent" application to manage a "child" application that runs in one JVM. If a child gets stuck in a cycle or is messy with resource management at all, the parent also suffers.]
source share