created on | January 28, 2022 |
In order to be able to access classes in libs or class files that are not part of the JDK, the classpath must be set according to the location of those libs and class files
The classpath can be set on the commandline when starting jshell:
or in jshell with the command :
A classpath is a list of classpath items. Classpath items can be directories containing class files, JAR files and ZIP archives. To separate items on Windows, use the semicolon ‘;’, on other systems use the colon ‘:’.
Note that setting the classpath with causes the execution state to be reset and all snippets entered in the current session are run again. The output of the snippets will not be displayed, however any error during the replay of the snippets will be displayed.
The classpath is displayed with the command without any parameter: