Java Classpath is basically a path to the directory which is used by Java Class Loaders to find and load the appropriate class in Java Program.
The procedure to set it varies from one operating system to another. In this article, we will teach you how to set java classpath on windows.
Step 1 – Open Advanced System Settings
First of all, open the control panel and click on the “system and security” option.
Once inside the system & security window, click on the “Advanced system settings” option there.
Step 2 – Click on the Environmental variables button
As a result, the system properties window will open up. Over there, click on the Environment variables button.
Step 3 – Create a Classpath
Now go to the system variables portion and click on the new button.
A new window will appear where we can create a new system variable. Type “CLASS PATH” inside variable name field. For the variable value, we have to give the full path of the “JDK folder” on our system
Once done with that, click on the OK button.
Step 4 – Check if classpath was configured correctly
After that our variable would appear under the system variables portion.
Now let us check whether we have configured our java classpath correctly or not.
For that, open the command prompt, type “java” and hit enter.
It would be noticed that the command prompt will recognize this command which means that windows has been integrated with the Java Classes Library through environmental variable. In this manner, you can set java classpath on windows.