Dynamically modify code

Hi

is there a way (or planned technology) that allows to modify code while the application is running?

I mean, besides the class loader, to dynamically load a class, is there a way to unload an already loaded class and load another (compatible) version of it?

thanks in advance

[302 byte] By [lbettoa] at [2007-11-27 2:35:54]
# 1
http://jakarta.apache.org/bcel/
YoGeea at 2007-7-12 2:54:40 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
> I mean, besides the class loader, to dynamically load> a class, is there a way to unload an already loaded> class and load another (compatible) version of it?As phrased - no.
jschella at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3
And I wouldn't expect that it would be added either since class loading specifically allows for it anyways.
jschella at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
I don't understand your answer: you said that it is not possible (your first answer) and then that class loading specifically allows for it anyway...
lbettoa at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5

> I don't understand your answer: you said that it is

> not possible (your first answer) and then that class

> loading specifically allows for it anyway...

You specifically asked for a solution that did not use a class loader.

But a solution exists using a class loader.

So due to your requirements there is no solution.

And no one is going to change that because everyone else (besides you) seems to be quite happy with using class loaders.

jschella at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6
so you mean that with a classloader you can unload an already loaded class and load another version of it? That's one of the points of my original question...
lbettoa at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7

> so you mean that with a classloader you can unload an

> already loaded class and load another version of it?

Yes.

> That's one of the points of my original question...

It seemed to me that your first post suggested specifically that you did not want to do that.

jschella at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 8

> > so you mean that with a classloader you can unload

> an

> > already loaded class and load another version of

> it?

>

> Yes.

OK, thanks, I really did not know this...

is there any documentation on how to unload a class?

>

> > That's one of the points of my original

> question...

>

> It seemed to me that your first post suggested

> specifically that you did not want to do that.

sorry for the misunderstanding: I was assuming it was not possible to unload a class with a class loader and so I had excluded that

lbettoa at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 9
> OK, thanks, I really did not know this...> is there any documentation on how to unload a class?Wrong conceptual model.You don't unload it. You stop using it - no active references.And you start using the new one.
jschella at 2007-7-12 2:54:41 > top of Java-index,Java HotSpot Virtual Machine,Specifications...