Class path

from Wikipedia, the free encyclopedia

A class path (or class search path ) is a path to one or more directories in which a runtime environment or a development tool searches for required components, for example referenced class libraries . In Java , class paths are specified via environment variables or passed as command line parameters when a program is called .

Setting a class path in the Java compiler

If the Java compiler is used, the class path can be classpathset with the attribute . Multiple paths must be listed separately with semicolons (under Unix-like systems with a colon).

Example in the Windows console :

javac -classpath "c:\Java\foo.jar;c:\Java\bar.jar" MySoftware.java

Explanation:

  • javac is the command for calling the Java compiler.
  • classpath is the option to set one or more class paths .
  • c: \ Java \ foo.jar and c: \ Java \ bar.jar are the class libraries to be integrated .
  • MySoftware.java is the file to be compiled.

Web links