This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi, I was given some java source code and a jar file which contains the corresponding classes. When I compile all the code (in IntelliJ) and jar up all classes (through ANT build script), my jar file is about 50% in size to the jar file I was given. All the classes' size are the same as before but the jar file size is halfed. Can anyone explain the reason why and whether (and how) I should fix this? Thanks in advance!
Does is need to be fixed? Is the jar file not working? There is a compression option when using the jar command. Some people choose not to compress the JAR file because it can slow down the loading process. So it could be that the people you got the jar from did not use compression and you have?? Again, does it really need to be fixed?
Helium, Please change your name to be compliant with JavaRanch's naming policy. Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name. You can change your name: here. Thanks, Cindy
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Oct 15, 2002
Thanks, Gregg, I tried to jar the files manually without compression and its about the same size. Our system has been developed in another country and I am taking over and continue the development. I have the jar and the source but I want to be absolutely sure that they match up.
Well, without knowing too much about what you do and what is required by your employer, I still wouldn't worry too much about the JAR file size matching exactly. There are a lot of things that can make a difference. One of course being the compression, and another is your original class file size. See, some IDE's include their own header information when compiling a class file. Which could increase the size. You can also supply an optimize tag when compiling that increase class file size as well. Also, I have noticed that when I compile my java files over and over and over and over....they continue to increase in size (not much mind you), then if I delete the class file and recompile the same code, the class file is smaller. I don't know why. Anyway, to make a long story short, if the JAR file works, then that seems good enough to me.