简体   繁体   English

Apache sources.jar和.jar文件有什么区别?

[英]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. 我对Apache commons-io很好奇,为什么它们在代码包中包含一个sources-jar。 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 ? 那么,为什么这些库在下载代码中还包含-sources jar? 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. 源JAR是,因此您可以阅读所需的代码。 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. 如果使用IDE,它可以知道下载此JAR,并且查看其中的类,它将显示源代码。 esp useful when debugging a program. esp在调试程序时很有用。 If you are not using an IDE, you can unpack the source and read it to understand what it is doing. 如果您不使用IDE,则可以解压缩源并阅读源代码以了解其功能。

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. 该源未包含在已编译的JAR中的原因是,因此,如果您正在做的所有事情都在运行程序(例如在生产中),则可以轻松删除该源。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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