Re: Serialize a class (not an object)
"James McGill" <jmcgill@cs.arizona.edu> wrote in message
news:1146760460.15379.8.camel@localhost.localdomain...
On Thu, 2006-05-04 at 15:49 +0000, Oliver Wong wrote:
So just send the file.
So on the receiving end, what kind of hoops do you have to jump through
to get a classloader to load such a file? Just curious.
From http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassLoader.html:
<quote>
A class loader is an object that is responsible for loading classes. The
class ClassLoader is an abstract class. Given the binary name of a class, a
class loader should attempt to locate or generate data that constitutes a
definition for the class. A typical strategy is to transform the name into a
file name and then read a "class file" of that name from a file system.
[...]
Normally, the Java virtual machine loads classes from the local file system
in a platform-dependent manner. For example, on UNIX systems, the virtual
machine loads classes from the directory defined by the CLASSPATH
environment variable.
However, some classes may not originate from a file; they may originate from
other sources, such as the network, or they could be constructed by an
application. The method defineClass converts an array of bytes into an
instance of class Class. Instances of this newly defined class can be
created using Class.newInstance.
</quote>
- Oliver