wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes my JarLoader breaks when replacing the jar file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "my JarLoader breaks when replacing the jar file" Watch "my JarLoader breaks when replacing the jar file" New topic
Author

my JarLoader breaks when replacing the jar file

Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
Hi

I have created a JarLoader class to load jar file at runtime. I want to keep different versions of jar files so I cache the JarLoader in a Map. The problem is when a jar file is loaded and I replace the jar file with a new file, the JarLoader can't find resources inside the jar file and it returns null.

It is strange because it was working before and all of a sudden it changed!!

Here is my jar loader:



The following is the test case I wrote:



I put a breakpoint on "is2" and replaced the jar with new one, and is2 then returned null and the same result for is3

I am wondered how come it was working before!

I also tested this URL "jar:file:/c:\\classpath/my-resources-0.0.1-SNAPSHOT.jar!/" isntead but no change!

Any idea is appreciated.


Regards, Mohammad
my.blog | my.photoblog | Add your name to SCJP Wall Of Fame
 
Don't get me started about those stupid light bulbs.
 
subject: my JarLoader breaks when replacing the jar file
 
Similar Threads
how to set different dir to resource bundle file
How to add new jar files to class path dynamically at runtime?
class loader
Classpath problems - java.class.path when using Manifest.mf
finding resources in classpath