[an error occurred while processing this directive]
public class ClassName { definition of object variables and methods }The class definition should be placed in a file named ClassName.java. Here, ClassName is the name of the class that you are defining. If you follow Java naming conventions, the name of each word in the class name should be capitalized. Spaces cannot be used in a class name.
Following this template, write a preliminary definition for the VectorSorter class. This preliminary definition will not have any object variables or methods so you will have nothing but a blank line between the braces in the class definition.
Before the class definition, you should also add an import statement:
import java.util.*;This allows you to use any class from the Java library package java.util. This package contains, among other things, the Vector class that you will be working with later.
After you have put the import statement and class definition into an appropriately named file, you can compile it with the Unix command
javac ClassName.javaThe compiler will create a file named ClassName.class. Try this with your VectorSorter class. You should not get any error messages from the compiler.
In addition, some of the classes that you write will need to import classes from packages that I will provide. In order to do this, you need to define a Unix environment variable to tell the compiler where my packages are. The easiest way to do this is to add the following line to the .cshrc file in your home directory.
setenv CLASSPATH ~gshute/public/java/classes:.Be sure to copy this exactly, including the period at the end. Doing this, by itself, has no immediate effect because the .cshrc file is only read when you log on to one of the Unix machines. In order to have an effect without logging out and logging back on, you should give the command
source .cshrcYou will only have to do this one time; the next time you log in, the .cshrc file will be read automatically.
In the next section, you will write another simple class with an import to check your class path.
import java.util.*; import gshute.util.*;As in the VectorSorter class, the import statements should appear before the class definition.
After you have put the import statement and class definition into an appropriately named file, you can compile it as described above. If you do not get any error messages then your class path is set up correctly and you are done with this step.
[an error occurred while processing this directive]