The environment variable is named CLASSPATH. Note: Either forward slashes or backslashes can be used in the class path on Microsoft Windows as the directory separator. On Microsoft Windows a similar class path should be set to this:Ĭ:/opt/some/path/classlib.jar c:/opt/some/path/otherclasslib.jar. opt/some/path/classlib.jar:/opt/some/path/otherclasslib.jar. Microsoft Windows uses a semicolon, while UNIX and Linux use a colon.įor example, to set the class path on Linux or UNIX to the locations /opt/some/path/classlib.jar, /opt/some/path/otherclasslib.jar, and the current directory (denoted by a single dot), you should set the class path to this: The delimiter used varies depending on the operating system. The class path consists of one or more directories or Java class libraries separated by a delimiter. If you set it as an environment variable, you will need to set it in the environment where you are running the Java program. There are two ways to set the class path: with an environment variable or with a command-line option of the JVM. The Java class path tells a Java compiler or Java Virtual Machine (JVM) where to look for Java classes and libraries needed to compile or run Java programs.