Class data access

I wasn't sure if this is the right forum, but this is as close as I can find.

Is it possible to obtain the actual class bytes of a Class from the VM? In the ClassLoader class, the actual class definition takes place in native, and as far as I know that isn't open source yet.

Since I know a lot of people arent going to get this, when I call defineClass with a byte array in a ClassLoader, is it possible to obtain those bytes elsewhere (to verify them, send them over net, etc)?

[501 byte] By [Zappackya] at [2007-11-26 13:51:27]
# 1

> I wasn't sure if this is the right forum, but this is

> as close as I can find.

>

> Is it possible to obtain the actual class bytes of a

> Class from the VM?

That would depend on the VM of course but probably not.

> In the ClassLoader class, the

> actual class definition takes place in native, and as

> far as I know that isn't open source yet.

>

Open source?

You can get the Sun source code if you want to look at it.

However the internals at that level are unlikely to ever be part of the Java API.

> Since I know a lot of people arent going to get this,

> when I call defineClass with a byte array in a

> ClassLoader, is it possible to obtain those bytes

> elsewhere (to verify them, send them over net, etc)?

If you are passing the array in then you can certainly keep a copy.

You can't get them back with the Java API. You might get them back with internal api calls but I doubt it.

jschella at 2007-7-8 1:28:45 > top of Java-index,Desktop,Runtime Environment...