Java problem with multiple threads when executing a runnable jar file
- by Spi1988
I have developed a Java Swing application, which uses the SwingWorker class to perform some long running tasks. When the application is run from the IDE (Netbeans), I can start multiple long running tasks simultaneously without any problem.
I created a runnable jar file for the application, in order to be able to run it from outside the IDE. The application when run from this jar file works well with the only exception that it doesn't allow me to start 2 long running tasks simultaneously.
When I start the first task (assume it takes 2 minitues to complete), every thing works fine, the UI does not freeze (it never freezes). However, when I try to run another task (assume it takes just 10 seconds, therefore it should finish before the first task) while the first task has not yet completed, nothing seems to happen. In reality, the second task would have started, and also finished its processing, however its results are only displayed once the first task completes.
I dunno why this is happening. Is there some restriction on the number of threads which could run simultaneously on the JVM? Are there any jvm arguments which i could try to solve this problem.
I hope i explained my problem well.
Thanks in advance,
Peter Bartolo