I have downloaded a .jar file and am using java with it, and it seems multithreaded, which is great ... unless I don't want it to be multithreaded, or unless I want to use only N threads with it.

Is there a way, in java, to specify how many threads you want to run a .jar file with without having access to the source code?

1 Answer 1


As it turns out the .jar file I downloaded was single threaded, but Java was using multithreaded garbage collection. To change the number of threads that Java uses for GC, I use java -XX:ParallelGCThreads=2 which fixed the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .