How to Set Classpath for Java in Windows

Classpath in Java refers to the path which will be used by the classloaders to load class in Java. If the classpath is not set correctly you are more likely to get ClassNotFoundException or NoClassDefFoundError exceptions. Classpath can be specified by using CLASSPATH variable in the Environment variable and using -cp or -classpath command line option. In this tutotrial we will learn how to set Classpath in Environment variable as well as command line. [Read more…]