I have been using JAR files to export my projects in my Java subject at school. I noticed it’s portability (assuming the computer in use has Java installed). However, with that fact, why haven’t I seen developers distribute Java programs using a JAR file? What are the pros (besides portability) and cons (aside from using C++) of using the JAR executable?
Share
I’m hoping that the advantages are pretty obvious. The biggest disadvantage I’ve run into is when there are additional dependencies that are required that aren’t included in the JAR. A MANIFEST can be included to set the classpath – but this requires that all of the dependencies exist with pre-defined names in a pre-defined location. This can be worked-around with a loader script (to set the classpath, etc.) – at which point not everything is contained in the single JAR anymore, and most of the advantages are lost.