A typical Jini package error looks like this:
Exception in thread "main" java.lang.NoClassDefFoundError: net/jini/discovery/DiscoveryListener
The Jini class files are all in jar files. The Jini distribution puts them in a lib subdirectory when they are unpacked. There are a whole bunch of these jar files:
jini-core.jar mahalo-dl.jar sun-util.jar jini-examples-dl.jar mahalo.jar tools.jar jini-examples.jar reggie-dl.jar reggie.jar jini-ext.jar
The jini-core.jar jar file contains the major packages of Jini:
net.jini.core net.jini.core.discovery net.jini.core.entry net.jini.core.event net.jini.core.lease net.jini.core.lookup net.jini.core.transaction
If the Java compiler or runtime can't find a class in one of these packages, then you need to make sure that the jini-core.jar file is in your CLASSPATH .
The jar file jini-ext.jar contains a set of packages that are not in the core, but are still heavily used:
net.jini.admin net.jini.discovery net.jini.entry net.jini.lease net.jini.lookup net.jini.lookup.entry net.jini.space
If the Java compiler or runtime can't find a class in one of these packages, then you need to make sure that the jini-ext.jar file is in your CLASSPATH .
The sun-util.jar jar file contains the packages from the com.sun.jini hierarchy. These contain a number of "convenience" classes that are not essential but can be useful. These are less frequently used.
A compile or run of a Jini application will typically have an environment set something like this: