Compiling the Math2 ClassThis section is a review of material first presented in Chapter 11, but it is useful to go over it again. The Math2 class was placed in the TechJava.MathLib package so we must be careful how we compile the Math2.java source code. Choose a root directory for the TechJava.MathLib package on your system. Create TechJava and TechJava\MathLib directories below the package root directory. Place the Math2.java source code in the TechJava\ MathLib directory. Compile the Math2.java program from the package root directory using the command javac TechJava\MathLib Math2.java Once this is done, add the package root directory to your CLASSPATH environment variable. You can now access the Math2 class methods from anywhere on your computer. |