Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executable jar running slower than Eclipse

My program works perfectly fine when I run from eclipse but I package it to an executable jar and run it from command line, it runs much slower (almost five times slower). I am even setting the -vmargs while executing the jar java -Xms40m -Xmx512m -jar jarFile.jar I do not have any older version of java on my machine. I am not able to understand what I am missing over here. How can eclipse run the same program faster while using the same version of java and same vm arguments. Any help would be appreciated.

Thanks, karthik

like image 747
karthik Avatar asked Apr 03 '12 05:04

karthik


1 Answers

We had a similar issue but the problem was that while exporting Java code as a runnable jar file from eclipse, we were choosing an option "Package Required Libraries into generated jar". This was putting all of the referenced libraries as jar files within the runnable jar, which probably was being unpackaged during every run. Instead of that we used "Extract required libraries into generated jar" option while creating the runnable jar file and the speed of the execution of jar shot up - almost same as it was while running the code within eclipse.

like image 108
JavaTec Avatar answered Nov 10 '22 05:11

JavaTec