Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

my JarLoader breaks when replacing the jar file  RSS feed

Mohammad Norouzi
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!