If you use J2SE 5 or higher version, it is not needed to use rmic to pregenerate stubs.
You can run rmiregistry in your code, so it is not necessary to run rmiregistry before running your app. The code looks like this:
LocateRegistry.createRegistry(int port);