Java Reference
In-Depth Information
FIGURE A.11
Running a Java
application.
If you cannot get the program to compile successfully even though you have typed it
exactly at it appears in the topic, there may be one last problem with how the kit is
configured on your system: The CLASSPATH environment variable might need to be
configured.
Setting Up the CLASSPATH Variable
All the Java programs that you write rely on two kinds of class files: the classes you cre-
ate and the Java class library, a set of hundreds of classes that represent the functionality
of the Java language.
The kit needs to know where to find Java class files on your system. In many cases, the
kit can figure this out on its own by looking in the folder where it was installed.
You also can set it up yourself by creating or modifying another environment variable:
CLASSPATH .
Setting the CLASSPATH on Windows 98 or Me
If you have compiled and run the HelloUser program successfully, the kit has been con-
figured successfully. You don't need to make any more changes to your system.
On the other hand, if you see a Class not found error or NoClassDefFound error when-
ever you try to run a program, you need to make sure your CLASSPATH variable is set up
correctly.
To do this, run Windows Notepad, choose File, Open and go to the root folder on your
system, and then open the file AUTOEXEC.BAT . A file containing several different MS-
DOS commands is opened in the editor, as shown in Figure A.12.
 
Search WWH ::




Custom Search