Saturday, April 5, 2008

ClassNotFoundException problem with rmiregistry

It is very possible that you will get ClassNotFoundException when you try Getting Started tutorial for RMI in JDK documentation. There is a easy way to fix it. Start rmiregistry and the server implementation in the same command line console on Windows (assuming that the current directory is the root directory of the class file tree for the example).
  • start rmiregistry

  • java example.hello.Server

The CLASSPATHs for both rmiregistry and java example.hello.Server must contains the path for the class file tree for the example if you want to run them from different command line console.

I have run into this problem twice. And JDK documentation does not explicitly specified. I searched the web. Remote Method Invocation (RMI) - RMI server ClassNotFoundExceptionsolves my problem.

So documentation is vital to software quality. Good documentation can save developers a lot of precious time.

No comments: