Reputation: 52
I noticed that I could compile multiple java programs/classes from the command line at the same time. Here's how I did it (they have to be in the same folder/location):
Is it possible to run them at the same time too? I've tried to do this multiple times, but it just doesn't seem to work. Either I get an error message, or the program fails to run.
Any Suggestions?
Upvotes: 0
Views: 3900
Reputation: 10891
Yes it is possible to run multiple java programs simultaneously. One way is to create a java program like so
class Main{
public static void main(String[]args){
new Thread(){
@Override
public void run(){
NameOfFirstJavaAppClass.main(fill,in,the,args);
}
}.start();
new Thread(){
@Override
public void run(){
NameOfSecondJavaAppClass.main(fill,in,the,args);
}
}.start();
}
}
Upvotes: 4