i've made two modules in java to complete my project. I want to run my two modules simultaneously. I've called these two modules from a third java program , which calls the two java modules( .jar files)
with the two Runtime Processess(i.e. p1 and p2).
Supposed code :
The problem is that, the second process executes only when the first process is completed ie.when the first module completes. Whereas i want to call these two processess p1 and p2 simultaneously, so that they can keep running and inducing their own results.
i've also tried this with multiple threading too, but the problem is intact.
I guess this sort of problem requires Multiple processing sort of solution.i've dug that concept on google but didn't find something fruitfull.Post some helpfull links if available and implementable.
Kindly reply with the short samples if possible. Thanks in advance.
Do you need to use rt.exec ? You could instantiate the main class and run its main method instead.
Joined: Feb 24, 2010
That won't matter i guess. Kindly write the code sample what you wanna say exactly , may b i might not b getting clear what u'r saying.The main problem is, i want to call these two modules to execute simultaneously and not one by one.
Vazzdoin Rocko wrote:The problem is that, the second process executes only when the first process is completed ie.when the first module completes.
That shouldn't be the case. It should be possible to use this technique to run the processes concurrently. Unfortunately, your code shown later does not achieve this. The primary problem is you've got all that code running inside the "testing" constructor, not inside the run() method. That means that it all gets run as part of the one main thread that starts everything - not as part of a separate thread that actually runs concurrently with other things. To achieve the latter, you need to put the code inside the run() method, not the constructor. The run() method is the part that gets run in a separate thread.