My mistake was on the second line. The correct command is:
java -classpath classDir -Djava.rmi.server.codebase=file:classDir/ example.hello.Server
The documentation says to use an & in the end of the command, but it works without it and I don't know its utility.
So I just executed this in one console: rmiregistry
And this in on the other console: java -classpath classDir -Djava.rmi.server.codebase=file:classDir/ example.hello.Server