How can I change the default RMI port (1099). It could be as JVM parameter or via coding, it doesn´t matter. Thanks.
You can specify it on the command line. From the RMI Tutorial:
By default, the registry runs on port 1099. To start the registry on a different port, specify the port number on the command line. Do not forget to unset your CLASSPATH environment variable.
Microsoft Windows:
start rmiregistry 2001
Solaris OS or Linux:
rmiregistry 2001 &
In your code you use the LocateRegistry.getRegistry(String host, int port) override to locate the registry by hostname and port, as explained in the Creating a Client Program section of the tutorial. (The same applies when implementing your server.)
http://java.sun.com/j2se/1.4.2/docs/guide/rmi/javarmiproperties.html:
java.rmi.activation.port (1.2 and later) This property is used to set the TCP port number on which this VM should communicate with rmid (by default, rmid listens on port 1098, but can be set to listen on a different port by using the -port option on the rmid command line). The default value of this property is 1098, so this property only needs to be set on VMs that need to communicate with an instance of rmid that is running on a port other than 1098.