When would I use the java.rmi.server.codebase property?

Govind Seshadri

The property java.rmi.server.codebase is used to specify a URL. This URL points to a file:, ftp:, or http: location which supplies classes for objects that are sent from this JRE. If a program running in a JRE sends an object to another JRE (as the return value from a method), that other JRE needs to load the class file for that object.

When RMI sends the object via serialization RMI embeds the URL specified by this parameter into the stream, alongside of the actual object.

It is important to note that RMI does not send class files along with the serialized objects.

If the remote JRE needs to load a class file for an object, it looks for the embedded URL and contacts the server at that location for the file.