Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

Eclipse, RMI, and stubs

Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Never mind -- I came to the conclusion that it's far easier to make the JAR manually.
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
We need your help - Coderanch server fundraiser
    Bookmark Topic Watch Topic
  • New Topic