O'Reilly logo

Head First Java, 2nd Edition by Bert Bates, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 18. Remote Deployment with RMI: Distributed Computing

image with no caption

Being remote doesn’t have to be a bad thing. Sure, things are easier when all the parts of your application are in one place, in one heap, with one JVM to rule them all. But that’s not always possible. Or desirable. What if your application handles powerful computations, but the end-users are on a wimpy little Java-enabled device? What if your app needs data from a database, but for security reasons, only code on your server can access the database? Imagine a big e-commerce back-end, that has to run within a transaction-management system? Sometimes, part of your app must run on a server, while another part (usually a client) must run on a different machine. In this chapter, we’ll learn to use Java’s amazingly simple Remote Method Invocation (RMI) technology. We’ll also take a quick peek at Servlets, Enterprise Java Beans (EJB), and Jini, and look at the ways in which EJB and Jini depend on RMI. We’ll end the book by writing one of the coolest things you can make in Java, a universal service browser.

image with no caption

Method calls are always between two objects on the same heap

So far in this book, every method we’ve invoked has been on an object running in the same virtual machine as the caller. In other words, the calling object and the callee ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required