简体   繁体   中英

What is the difference between the Apache sources.jar and .jar files?

I'm curious about Apache commons-io, why do they include a sources-jar inside the code package. We will not compile the program like so :

javac -cp .;.\lib\commons-io-2.4-sources.jar  myCode.java

But we compile it like this :

javac -cp .;.\lib\commons-io-2.4.jar  myCode.java

So why do the libraries also include a -sources jar in the download code ? I'm guessing it's for studying the source code, if we want to add/improve ?

The source JAR is so you can read the code is you want to. If you use an IDE, it can know to down load this JAR and if you look at a class in it, it will show your the source. esp useful when debugging a program. If you are not using an IDE, you can unpack the source and read it to understand what it is doing.

The reason the source is not included in the compiled JAR is so it can be easily dropped if all your are doing is running the program eg in production.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM