While using a JAR file when a directory is specified in the classpath, the files are searched in the directory specified and not in the directories up in the hierarchy. Also, the dot (.) operator means that the files are to be searched in the current directory also. The list of the files in the Windows environment are separated using a semicolon (;).
In the case of the Unix environment, the names of the files are separated using the colon (:) operator. In the command-line, the directory structure is represented using the forward slash (/) in place of the backward slash (\). The semicolon (;) separated list of directories specify the locations to search the files in the specified directories. The files are searched in the directories specified, and not in the directories up in the hierarchy. For example:
-classpath uc\ProgramCodeFiles\MyFiles;uc\JAVAFiles;.;
Here, files will be searched in the current directory, the MyFiles directory, and the JAVAFiles directory.
Responses to “How the classpath is searched for a JAR file syntax?”