• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jar file sizes

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Rob Chung
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rob Chung
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic