This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Distributed Java and the fly likes Problems with a simple RMI Hello World Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Problems with a simple RMI Hello World" Watch "Problems with a simple RMI Hello World" New topic

Problems with a simple RMI Hello World

oli mueller
Ranch Hand

Joined: Feb 13, 2011
Posts: 42

I would like to try a simple RMI hello world with Java1.5 (and using eclipse if that matters). I have probably tryed every available step-by-step tutorial on the web - none of them works for me...what am i doing wrong...

(1) Some make some changes in the .policy files, some don*t....some have enter some "codebase", others dont...I am getting ClassNotFoundExceptions in any case....

Here is what i am doing...
The interface:

The Server-class...(if i run it from eclipse, i am getting classnotfoundexceptions....)

...i leave the client out, as it is not so interesting at the moment. I do have my rmiregistry running...Does anybody know, WHAT exactly I have to configure and WHERE exactly....all tutorials I found on the web, focus on the source code (which is perfectly clear in my opinion), but they are very thin on these configurations to make the bloody thing running.....

Joe Ess

Joined: Oct 29, 2001
Posts: 9191

oli mueller wrote:
The Server-class...(if i run it from eclipse, i am getting classnotfoundexceptions....)

What is the full exception stack trace?

[How To Ask Questions On JavaRanch]
Rob Spoor

Joined: Oct 27, 2005
Posts: 20279

Moving to Distributed Java.

How To Ask Questions How To Answer Questions
Mir Mohammed Easin

Joined: Mar 07, 2011
Posts: 4
If your exception is regarding stub class like Server_Stub.class or remote object class not found which means when you try to run your RMI server, you need to create stub class of your remote object class. For JDK1.6 doesn't need. So you've to create a Stub class as follow:

<class_directory>rmic example.hello.Server

It'll generate Server_Stub.class [also can generate Server_Skel.class for JDK1.4]. And then you need to specify codebase into your command line like:

<class_directory>java -Djava.rmi.server.codebase=file://<class directory path>/ example.hello.Server

You can programically define above codebase in your Server program:

I hope you'll not get any exception regarding class not found.

I agree. Here's the link:
subject: Problems with a simple RMI Hello World
It's not a secret anymore!