同一个包的类可以分布在多个Jar文件中吗?
问题描述:
我正在使用JAR文件中的一些类,它们属于一个包(com.abc.xyz)。
I am using some classes from a JAR file and they belong to a package (com.abc.xyz).
我写的类也属于该包但我无法将我的文件捆绑到该JAR文件中。是否可以将属于同一个包的类分布在多个JAR文件中?
The class am writing also belongs to that package but I won't be able to bundle my file into that JAR file. Is it possible to have classes that belong to the same package spread across multiple JAR files?
答
默认情况下,绝对是。
但是,如果您想要以确保来自特定包的类仅从 加载一个jar文件,那么可以将该信息添加到清单。
However, if you want to make sure that classes from a particular package are only loaded from one jar file, you can add that information to the manifest.