Results 1 to 9 of 9
Thread: Different versions of Jar
- 09-14-2009, 06:27 PM #1
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
Different versions of Jar
Hi,
I have a webapplication that uses Saxon8.jar but now I have to add some new functionality to the webapplication and for that Saxon9.jar is ideal. Without affecting or breaking previously written code, how can I dynamically load/unload JAR (saxon9.jar specifically)?
For example:
Whenever the new functionality in the webapplication is invoked, Saxon9.jar is loaded, completes the job, and then unloads.
I have tried URLCLassLoader but that doesn't seem to work for me or maybe I do not know how to use it to get Factory classes and then objects from the factory.
If anyone can help that would be really helpful.
Thank you.
- 09-14-2009, 06:51 PM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Do you mean that you want to use both jars? Why not just replace the old jar with the new version?
- 09-14-2009, 07:08 PM #3
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
New version of the library is not backward compatible and that is the problem
- 09-14-2009, 07:16 PM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Trying to use both versions at the same time will give you problems if not impossible.
Better choose the one where you have less work to do to adapt your code and use that one.
- 09-14-2009, 07:19 PM #5
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
Having only one version doesn't seem to be an option.
Any thing that could be done?
- 09-14-2009, 07:27 PM #6
you cannot load both at the same time (unless you change the package path)
but you can dynamically load a class from a specified jar path. In other words use the URLClassLoader to load a class stored in a jar:
Java Code:filePath = "jar:file://" + jarPath + "!/";
Last edited by mrmatt1111; 09-14-2009 at 07:36 PM.
My Hobby Project: LegacyClone
- 09-14-2009, 08:15 PM #7
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
Thanks mrmatt1111.
URLClassLoader is what I have been playing with but simple classes are ok, you get an instance of the class and you are good to go. How about something like:
TFactory tf = TFactory.newFactory();
TClass tcl = tf.getNewTClass( abc, xyz);
I don't think this is possible with URLCLassLoader, it doesn't even compile.
- 09-14-2009, 08:21 PM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
What if those those classes you are trying to load depend on new classes as well?
- 09-14-2009, 08:53 PM #9
Member
- Join Date
- Mar 2008
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
Java Versions
By hiranya in forum New To JavaReplies: 6Last Post: 10-27-2009, 12:42 PM -
JDK versions on web server and client machines
By sunjavaboy in forum New To JavaReplies: 1Last Post: 03-21-2008, 04:59 AM -
Can I delete/uninstall older versions of Java?
By LudwigKarl in forum New To JavaReplies: 3Last Post: 03-19-2008, 10:23 AM -
Using different versions of Java
By javaplus in forum New To JavaReplies: 2Last Post: 01-04-2008, 08:28 PM -
Concurrent Versions System (CVS)
By JavaForums in forum EclipseReplies: 0Last Post: 05-02-2007, 03:03 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks