File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse, RMI, and stubs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse, RMI, and stubs" Watch "Eclipse, RMI, and stubs" New topic

Eclipse, RMI, and stubs

Stephen Tracey

Joined: Apr 08, 2004
Posts: 13
Warning: this isn't pretty. I'm hoping that this nonsense makes sense to someone out there.

I am:
1. working on an SCJD project that involves RMI -- without downloading classes through a web server (i.e. all the class files are delivered in 1 jar)
2. using Eclipse for an IDE
3. aware of how to use rmic from the command line to generate stub files
4. resorting to the use of batch files to get RMI stubs into my deployment JAR
5. looking for a less-manual method
6. pretty new to Java, so in favor of a simple solution

Basically, I have a file, upon which my batch file runs rmic. The resulting ServerData_Stub.jar is placed into the bin/server directory by the batch file. When I execute from Eclipse, -- for execution from Eclipse a jar seems to be required -- the jar is found because I listed it in the project's library build path. One bad thing is, since I don't keep the stub file as a source file, it's only in the bin directory, when I choose "Rebuild All" it always fails then I have to regenerate the stub. This is kludgy. (Should I treat the stub as a source file? Doesn't seem right to me.)

I noticed that jpg files, when treated as source, get copied to the bin directory during build. I wish I had that for the stub jar! But I'd need the same for the stub class too, as the next paragraph shows.

When I tell Eclipse to export to a jar, Eclipse doesn't put the stub in the jar because it was generated outside of Eclipse. So I have a second batch file that adds the stub to the jar. Only, instead of putting the stub jar in the deployment jar, I put the class file in there because the deployment jar won't run if the stub was included as a jar.

I downloaded Gennady's RMI plugin for Eclipse, but it gave me errors and I don't have the patience to fight through them. Especially since I now have a working solution.

OK, what do I want? I don't mind having to remember to run rmic whenever I change the file, but the rest of this is tiresome. Any suggestions on what I should do?

I know that this is painful to much moreso to have lived it!

Stephen Tracey

Joined: Apr 08, 2004
Posts: 13
Never mind -- I came to the conclusion that it's far easier to make the JAR manually.
subject: Eclipse, RMI, and stubs
It's not a secret anymore!