Sunday, May 10, 2009

Problems with Jar files

As a developer from a company which uses OSGi for most of their products I thought of discussing the problems we are having with typical jar files. Most of those issues are solved in OSGi Environment.Don't think twice OSGify your products to achieve real modularity for your software.
First and major issue with simple jar files is not having a runtime concept, they are meaningful only during compile time. At runtime no changes could be done to a jar,it is just expose in to all the jar files in the environment which import it.Jar files doesn't contain any meta data about their dependencies and we do not have any control over the dependency management of jar files. All the classes in the jar is expose in to all the packages of the environment. In simple there's not information hiding between jar files in the Java runtime Environment. So I could say those words something like this. With OOP(Object Oriented Programming) we are achieving information hiding in class level but that's is, how nice if we could achieve that in modular level like exposing some of the packages(making public as we do in public methods and public variables in a class) and hide other packages of a particular jar file. And we can consider this as no communication mechanism between jar files in the horizontal direction, it just allow users to communication through the vertical direction by importing packages. No horizontal communication at all ....:-(

With typical jar files if we have different versions of the same jar it will just pick the appropriate class from the classpath according to the order we are specifying the classpath, so we couldn't consider this as a proper versioning system.

Next issue I would discuss is lack of dependency information in a single jar file. Most of the jar files are always depends on other third party jar, but we do not have any proper way of keeping that meta data describe the dependency for a given Jar file. This cause people to get a very popular Exception called ClassNotFoundException.

Keeping only the dependency information in not enough, we should have a proper understanding about the versions of those dependencies otherwise we couldn't guarantee the behaviour since different versions could be having different behaviours. So with the dependency we should have the version information included on it.

I have described couple of issues we are having with typical jar files and I will be blogging on how OSGi(Open System Gateway initiative) is going to solve almost all of the above issues and Lead Software Development in to new Modularity concept which will be an elegant feature of Java world.

1 comment :

Anonymous said...

Hi! Your blog is simply super. you have create a differentiate. Thanks for the sharing this website. it is very useful professional knowledge. Great idea you know about company background.
Increasing your web traffic and page views Add, add your website in