How to make, use and compile packages. Example: the Pumpkin package, containing two public classes Pumpkin and CarvedPumpkin. It is used in the applet myApplet, which also needs the public class MouseHandler. To start with, assume that all the files are in a current directory, referred to from now on as "current". Under Linux =========== 1. In the files containing the classes that you want to go into the package, add, as first line of each file: package Pumpkin; 2. Create a directory Pumpkin in the current directory: mkdir Pumpkin Move the two files Pumpkin.java and CarvedPumpkin.java into this directory. 3. Compile the package from outside the Pumpkin directory, i.e. from the current directory, as follows: javac Pumpkin/*.java 4. Now let's take care of the rest of the program, where the package is being used. In the main program myApplet.java, add the line: import Pumpkin.*; 5. Compile the file from the current directory: javac myApplet.java This will compile myApplet.java and MouseHandler.java 6. Now you can view the applet as usually, by opening the myApplet.html file where it is invoked. Under Windows ============= For some reason, my Windows XP system needed more fiddling to do the same thing. In particular, before running the compilation in step 5, it wanted the classpath variable to be set, as follows: set CLASSPATH=C:\Ileana\PublicHtml\Teaching\Courses\112\Packages;. (I created a directory Packages at the top level of 112, where I was planning to put all the packages). Well, step 4 worked, then 5 compiled after setting the CLASSPATH, but then the applet won't load. I had to move the class files for Pumpkin in the same directory as the applet and the html file. Not clear yet how to fic this. To resume. Reading: packages from BigJava book, Horstman.