How to create a process in Java [closed]

I would like to create a process in my application. But after looking around and from Java's API I still don't quite get it.

Basically I want to create a multi process application. But the new process is a class in my application.

I know some of you might ask why not create a thread? Because the class is calling a matlab code, the problem and the Java class is Here

Is there any way to do this?


Solution 1:

Maybe java.lang.Process could help here ..

The ProcessBuilder.start() and Runtime.exec methods create a native process and return an instance of a subclass of Process that can be used to control the process and obtain information about it. The class Process provides methods for performing input from the process, performing output to the process, waiting for the process to complete, checking the exit status of the process, and destroying (killing) the process.

Solution 2:

There is only one way to create processes in Java, Runtime.exec() - basically it allows you to start a new JVM just as you would via the command line interface.