This
simple Jini service returns the current time in milliseconds when
it's getTime() method in invoked.

The
Steps involved in developing a Jini Service are

1. Code the Jini Service
Interface
2. Code the Jini Service
3. Compile the Code and generate stubs
4. Start up the Service

1. Code the Jini
Service Interface

MyServerInterface.java

import
java.rmi.*;

/***************************************************************************
MyServerInterface -- The Server's Methods that are
Available Remotely
***************************************************************************/

try { /*
Setting the security manager to allow the
RMI class loader
to go to the codebase for classes that are
not available
locally.
==========================================================
*/ System.setSecurityManager (new
RMISecurityManager ());

/*
Create the attributes (an array of entry
objects) that describe
this server and use it to register this
server with the lookup
service. JoinManager finds and registers
with the lookup
service.
===============================================================
*/ aeAttributes = new Entry[1];
aeAttributes[0] = new
Name("MyServer");
myServer = new MyServer(); joinmanager = new
JoinManager(myServer,aeAttributes,myServer,new
LeaseRenewalManager());
System.out.println("MyServer:
JoinManager = " + joinmanager);

/*
Itemize the service items and the service
objects that are
available in the lookup service. Note:
Sometimes this is
executed too quickly for the service that
was registered above
to show up.
==============================================================
*/
try {Thread.sleep (2000);} catch (Exception
e) {}