Friday, 11 January 2008
Add a jar file to Java load path at run time
Sometimes it is necessary to amend the class load path at run time. For example, dynamically adding jar files containing user-configurable JDBC data sources. The way this is done is truly monstrous -- the URL Path format was only revealed when a colleague looked into the Java library sources. Here is a simple example of how this is done jar-loader-src-0.1.jar which, as usual, has an ant build file: just type "ant run" at the shell prompt to compile and run it. You need ant and JDK >= 1.5 for this.
Subscribe to:
Post Comments (Atom)
2 comments:
hi was not able to get the example
jar-loader-src-0.1.jar
Oops -- looks like I moved stuff around and left the blog files out. I have put a fresh copy there for all to see.
Regards, Mike Wilson
Post a Comment