开发者

Difference between export to a jar and running directly in eclipse

开发者 https://www.devze.com 2023-01-18 07:35 出处:网络
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.

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 开发者_如何学Pythonfrom eclipse 2. export to jar


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号