A typical Java packages error looks like this:
Exception in thread "main" java.lang.NoClassDefFoundError: basic/InvalidLookupLocator
Most of the code in this tutorial is organized into packages. To run the examples, the classes must be accessible from your class path . For example, one of the programs in the basic directory is InvalidLookupLocator.java . This defines the class InvalidLookupLocator in the basic package. The program must be run using the fully qualified path name , like this:
Note the use of the period (.), not a slash (/).
In order to find this class, the CLASSPATH must be set correctly for the Java runtime. If you have copied the classes.zip file, the class files for this tutorial are in there. You only need to reference this:
If you have downloaded the source files, then they are all in subdirectories, such as basic , complex , etc. After compilation, the class files should also be in the subdirectories, such as basic/InvalidLookupLocator.class . An alternative to using classes.zip is to set the CLASSPATH to include the directory containing those subdirectories. For example, if the full path is /home/jan/classes/basic/ InvalidLookupLocator.class , then set the CLASSPATH to
An alternative to setting the CLASSPATH environment variable is to use the -classpath option to the Java runtime engine, like this:
java -classpath /home/jan/classes basic.InvalidLookupLocator