Java problems reloading code using ClassLoader?

I am guessing you are using two class loaders. One, the system class loader, with the bulk of your code in it. Your custom class loader uses the system class loader as its parent.

You are trying to get the custom class loader to replace a class in the system class loader. In fact the custom class loader will delegate to the parent in preference to loading its own classes.

I am guessing you are using two class loaders. One, the system class loader, with the bulk of your code in it. Your custom class loader uses the system class loader as its parent.

You are trying to get the custom class loader to replace a class in the system class loader. In fact the custom class loader will delegate to the parent in preference to loading its own classes. What you need to do is make sure that the system class loader loads no implementation of the class.

Create a class loader that loads an implementation of the class and delegates to the system class loader. To change implementation create another instance of the class loader. (Using java.net.URLClassLoader.

NewInstance is probably easier the creating your own class loader implementation. ).

I AM creating a new class loader instance as you can see above in the replaceVar function. The "bulk of the code" consists of the loop as well as the ping() function in the MyVar classes as this is just a sandbox experiment at the moment. – Glader Jun 21 '10 at 8:52.

I managed to solve the problem. I forgot to keep the files out of the classpath which made the ClassLoader read a new instance only if it was of a different class implementing the same interface and not when I replaced the class with a different version. So basically: problem solved by removing the files from the project and editing them externally.

If this is the resolution, you should self accept it so it's clear your question has been answered (albeit by yourself). – Software Monkey Jun 25 '10 at 0:38.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions