I have done several projects and packaged them into jar files, but I noticed that my jar files are much slower than in my IDE.
I use Eclipse to compile and run my programs. Everything works for me in Eclipse. When I pack my project as a running Jar and double-click it, everything still works. But when I have animation, the program slowly starts extreme . Instead of 30 frames per second in Eclipse, I now get about 2 frames per second. The animation is very laggy.
Interestingly, when I run the same Jar from the command line ( java -jar MyCode.jar ), the lag disappears and my program works fine.
I do not currently know what causes this problem. My computer is running Windows Vista. I am using the latest version of JRE and JDK. My program contains animation, nothing unusual.
Thanx
Solution: There were several different versions of Java on my computer, and the incorrect version was used.
source share