I see many Java packages have api, impl and bundle jars (name-api.jar, name-impl.jar, name-bundle.jar). Could someone explain what those mean? Are all three needed by the ap
The idea is that you can separate the dependencies of the application; in an attempt to make applications more portable. The idea is that you can make the application dependent on the api.jar
when compiling. Then when you want to run the program you can then switch in the appropriate implementation jar (impl.jar
) and the appropriate resource bundle jar (bundle.jar
).
As an example suppose the library does some database interaction. You write your code so that it references the api.jar
. Now suppose you need it to work with a specific type of database e.g. MySQL - you would then add the impl.jar
that is specific to MySQL databases to the classpath to get it to work (if you need a different database later - you only need to switch that jar in the classpath).
The bundle.jar
is a bit more obscure and not as common. This could be used to supply configuration setting for the library. For example it could be used to supply language specific settings, or some more specific config. In the case of the database library it might be that the implementation is designed for all versions of MySQL, and the resource bundle jar provides config files that allow it to work for a specific MySQL version.