For the Developer's exam, I have been doing experiments with the rmi property: rmi.server.codebase. It does not seem to be working. I did the following steps: 1.All the necessary classes including the stubs, skeletons and interface are in a directory called C:\RMI\classes. 2.At the MS-DOS command prompt I start the rmiregistry. 3.Then in another MS-DOS window I went to the root directory (C:\> and type in the line as below: C:\>java -Djava.rmi.server.codebase=file:/C:\RMI\classes WeatherServer Where WeatherServer is the name of the program that implements the interface.
It does not work. I kept getting the message �NoClassDefFoundError� Can anybody shed some light on it?
posted 13 years ago
Even though you are specifying a codebase, you still need to make sure the classpath is set. The codebase property is a value that is sent to the client by the rmi runtime to let the client know where to download the files from, but in the context of running your WeatherServer class you still need to specify to the JVM where to find the classes, just as you would when executing any java program. Try something like: C:\>java -cp %CLASSPATH%;c:\pathtoyourclasses -Djava.rmi.server.codebase=file:///C:\RMI\classes WeatherServer -BJ