views:

65

answers:

2

I have a requirement that i need to load two versions of a jar at once. To avoid class path collisions I'd like to rename the packages of one of the jars. Then in source you could always easily determine the version by the package name.

I've played with javap but couldn't find an assembler for Java 1.6. I've also attempted to decompile the code with JD but it never quite got it right and it wouldn't compile.

+1  A: 

Another thing to consider instead of manually modifying the classes is to use some class loader magic. I've never done this myself, but have read a bit about it. There is an article on devx which explains how to load multiple versions of classes.

John Paulett
That was considered but we decided if we wanted to start muching to classloaders we should just do it right and use OSGI. Unfortunately there isn't time to implement that.
Patrick Auld
+1  A: 

You can use the opensource package : JclLoader which helps in loading different versions of the same jar. This was also a need in one of our systems to do testing .

Link: http://sourceforge.net/projects/jcloader/

techzen