Classpath

Official Content

The Classpath is an environment variable to be configured with the list of directories/files that include the classes selected for use in Java applications.

In compilation/run time, both Java Development Kits and Java Runtime Enviroments search through directories for classes referenced in the classpath environment variable. Therefore,  when this variable is not properly configured, the search fails and results in an error.

Generally, it is possible to configure the Classpath variable in machines using Windows, by means of the Control Panel. It is also possible to do it in a command prompt. It should be clear that from the latter method, the classpath configuration will remain valid for the compilation/execution of Java applications in such console during the period that is it open.

For GeneXus-Java applications, the Build Process properties include the “Classpath” property to facilitate any directories/files necessary, and to enable reference to them in it. Indicating in Classpath a structure of directories means that all .class files within such structure will be located/accessible at compiling/run time.

For the case of .class files compressed into .ZIP or .JAR files, in addition to indicating the structure of directories in the Classpath property, it is also necessary to explicitly indicate the name of the compressed file.