Set java classpath using the java command options Use Code KNOWPROGRAM10 to get FLAT 10% OFF on all Courses If classes are saved in a different directory, for executing themįrom the current directory we must set the classpath. class file in the current working directory only. Now, can weĮxecute it from the current working directory? No, because by default class file is not in the current working directory. JVM needs a classpath variable while executing our class file for finding library files that are used from our class. The programmer will set the classpath variable by storing the software libraries’ file path. Classpath is a mediator between the programmer and the compiler. If our Java application is using third party APIs or user-defined APIs (other than JDK APIs) then those API related directories or jar files must be added to the classpath environment variable to make Java tools recognizing and using the APIs.Ĭlasspath is used for finding library files of software, i.e. The classpath is a purely Java-related environment variable. What is java classpath? We will discuss the different ways to set Java classpath environment variables in windows operating system What is Java classpath?