So I just spent the last few hours attempting to get Java RMI working. This was not easy. However, the good news is that now you can benefit from it! Link at the end, but first my story…
Last night, I was wondering how you would connect two Java applications together. The reason for this is because I want to try and have an embedded Tomcat server inside of an application, but also have the capability of developing the webapp separately, since developing both the embedded server and the webapp in the same project did not seem to work very well. I figured that I could use something like DBus-Java to do this, however I wanted it easily cross-platform.
As it turns out, Java already has something like that built-in! In the form of RMI, or Remote Method Invocation. However, the example that they give in the Java Tutorials is not particularly clear. It also seems to be out of date, although if it actually is I am not sure. There are several important parts that the tutorial does not go over. Other documentation talking about what you need to do does not appear to be up to date either, much if it appears to date from Java 6 and before.
Since this was such a hard thing to figure out, I’ve made a standalone Maven project that goes and sets up an RMI client and server. Hopefully it will help somebody else in the future.