The Artima Developer Community
Sponsored Link

Java Seminars by Bill Venners
Jini Example Code
Download Page

You can download a zip file of the example code from the Jini lecture, which have been updated to work with the 1.0 Jini release that works with the JDK1.2FCS release. The zip file contains the following .java files along with their .class counterparts:

  • InvalidLongException.java
  • Summer.java
  • SummerService.java
  • SummerClient.java
  • SummerClient2.java
  • LSP.java (Lookup Service Ping)
  • LSD.java (Lookup Service Directory)
  • LSF.java (Lookup Service Find)

The first thing you'll need to do to get this code running is download the Jini code from the Java Developer Connection:

http://developer.java.sun.com/developer/products/jini

The Jini release requires JDK1.2FCS to run. You can get this at:

http://java.sun.com/products/jdk/1.2/

I got started by downloading Noel Enete's Nuggets, which you can find at:

http://www.enete.com/download/#_nuggets_

I recommend downloading Noel's Nuggets and getting his examples to work first, because he includes very detailed instructions on his web pages.

I followed Noel Enete's instructions on getting a Jini infrastructure running on my standalone Windows 95 laptop. I found this to be the most troublesome part, probably because of my Windows 95 setup. Nevertheless, what I did was:

  • started the webserver that comes with the Jini download
  • started RMIREGISTRY
  • started RMID (the RMI Activation server)
  • I then had to wait about 5 minutes, for RMID to do something I was never able to figure out
  • Then, I started Reggie, which took about 30 seconds or so to install itself as an Activatable object

To get the example code from my Jini lecture to run:

  • Download the code and unzip it
  • Make sure the Jini .jar files are in your CLASSPATH environment variable
  • Compile the code with a javac *.java
  • I then copy all the .class files to the directory where the web server will be looking for files
  • You can now run LSD, LSP, and LSF (LSD and LSP require a Jini URL of a lookup service as an argument to the command line)
  • To run the SummerService, do an rmic SummerService to get a stub and skeleton
  • I then move all the SummerService files to a different directory and start it. It will register itself with a lookup service at "jini://localhost"
  • I then moved the SummerClient files to a different directory and started it. SummerClient will look for a summer service in a lookup service at "jini://localhost" and let you type in numbers, which it will pass along to the summer service to add
  • SummerClient2 works the same as summer service, but performs its lookup by type rather than attribute

Good luck.


Sponsored Links

Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us