Friday, July 18, 2014

Resolving JAR hell The Hack

Resolving JAR hell The Hack

I never knew about how Java class loader works. Frankly speaking just read this line while interview preparation.

When explored I came to know how it really works, how bootstrap/system classpath makes a difference, how web app lib directory creates a significant difference and all.




Actually there is a way to solve this and this is using your custom class loader but well sometimes you run out of time when you have a crunched time and a critical delivery ahead and that's where I was standing.


I had a situation to load "XSSFWorkbook" in my web application to read data from excel sheet and had two JARS "poi-ooxml-3.9.jar" and "org.eclipse.birt.runtime_4.3.1.v20130918-1142.jar" with same class name and package structure. I simply remaned the later so in its alphabetical order comes next to the earlier one and it did a trick for me. Just wanted to share the same.

Hope this will help somebody from some sleepless nights and crunched situation


Well and curious to mention that this is my very first post so apologize for incorrect English comprehension and excited to see you all sharing knowledge.

Good Luck

No comments:

Post a Comment