tags:

views:

45

answers:

2

I am writing a java program, and I have a test to see what is the performance of my program.

While it has difference result when I run it directly in eclipse and export to a jar.

Running directly in eclipse is 2 times faster.

Can anyone tell me about the difference between: 1. Run from eclipse 2. export to jar

A: 

When you create a JAR, it is really just a container for all of the class files that the JVM uses to run the Java program. When running it in Eclipse, it is like calling java <class name>.java. Using a JAR may take extra time because of the way the class files are loaded from the JAR itself.

Glenn Nelson
A: 

Probably the difference you see is the extra time you need to load new classes in execution time from the jar, as it is compressed it needs to do extra job to find the file and load it. while Eclipse uses unpackaged files so it is faster.

frisco