Setting the CLASSPATH Environment Variable

The CLASSPATH is the path that the Java Runtime Environment (JRE) searches in order to find CLASS, JAR, and other resource files. You can use one of these two methods to set the CLASSPATH:
  • Use the -classpath option with a software development kit (SDK) tool such as java. This method enables you to set the CLASSPATH for each individual application.
  • Set the CLASSPATH environment variable. This recommended method makes the CLASSPATH available for all applications by default.
When setting the CLASSPATH as an environment variable, follow these guidelines:
  • Set the CLASSPATH as an environment variable for the user (not the system).
  • Do not forget to precede the CLASSPATH with a period (.). If you leave out the period and you invoke Java from the same location as your application code, you get the error: java.lang.NoClassDefFoundError. This requirement applies only when the JAR file is in the current directory.
  • Add the SAS Drivers for JDBC JAR files to the CLASSPATH. You cannot point to the directory that contains the JAR files.
    • The SAS/SHARE driver needs sas.core.jar and sas.intrnet.javatools.jar.
    • The IOM driver needs sas.core.jar and sas.svc.connection.jar. If the Security Support Provider Interface (SSPI) feature is used, then sas.security.sspi.jar is also needed.
Here are some considerations:
  • If there is a conflict, the order in which the JAR files appear on the CLASSPATH determines which class is used.
  • If you change the CLASSPATH, you do not need to reboot. However, if you are running from a command prompt, you must bring up a new command prompt. If you are running an applet, you might need to close Microsoft Explorer and then restart it.
  • If you get a logger class not found message, then you are using a version of the JRE that is earlier than 1.4.1. To determine which JRE you are accessing, enter java -version on the command line.