Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I run a jar file in multiple threads?

I need to run an executable JAR file in multiple threads/cores. The JAR file does not implement Runnable. I've been looking for a way to do that and haven't found one. Is it possible to make a JAR file use multiple threads/cores without having access to the source code?

Currently. if I just run the JAR file normally, it only uses a single core.

like image 593
user1258361 Avatar asked Oct 14 '25 07:10

user1258361


2 Answers

There is no way to magically make a program (doesn't matter if it's packaged in a Java JAR file or some other way) automatically use multiple cores. The program must have been written to make use of multiple cores - there's no other way.

like image 183
Jesper Avatar answered Oct 16 '25 20:10

Jesper


No, you can't. You can run several java processes running the same JAR in different threads, but this might not be what you want.

like image 43
Tomasz Nurkiewicz Avatar answered Oct 16 '25 21:10

Tomasz Nurkiewicz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!