Setting the Classpath

set CLASSPATH = /user/projects/classes
											java –classpath =
											CLASSPATH%;classes/classa.class;libs/stuff.jar

The classpath is used by the java executable and the java compiler to find the compiled class files and any libraries packaged as JAR files required to run or compile a program. JAR files are the standard way of packaging libraries into a single file resource. The preceding phrase shows how the classpath can be set when executing a java program at the command line. By default, the classpath is obtained from the operating system CLASSPATH environment variable. In the phrase, a specific class, classfile.class, located in the classes directory, is appended to the classpath set by the environment variable. A library called ...

Get Java™ Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.